求助 CF 运行结果和本地运行结果不一致
查看原帖
求助 CF 运行结果和本地运行结果不一致
372708
Yahbim楼主2022/3/29 15:25

CF:

Test: #1, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER

Input
1 1 2 3 1 0
2 4 20

Output
104

Answer
3

Checker Log
wrong answer 1st numbers differ - expected: '3', found: '104'

然而本地跑出来的确是 3。

有没有知道怎么破的大佬,感谢。

#include<bits/stdc++.h>
#define debug(x) (printf(#x"="),write_n(x))
#define file_in(x) (freopen(#x".in","r",stdin))
#define file_out(x) (freopen(#x".out","w",stdout))
typedef long long ll;
typedef double db;
const int INF=0x3f3f3f3f;
const ll INFLL=0x3f3f3f3f3f3f3f3f;
const int N=105;

template<typename T> T min(T x,T y){return x<y?x:y;}
template<typename T> T max(T x,T y){return x<y?y:x;}

namespace IO{
    template<typename T> T read(T ret=0,int w=0,char ch=getchar()){
	while(!isdigit(ch)) w=ch=='-',ch=getchar();
	while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
	return w?-ret:ret;
    }
    template<typename T> void write(T x){
	if(x<0) return putchar('-'),write(-x);
	if(x>9) write(x/10);
	putchar('0'+x%10);
    }
    template<typename T> void write_s(T x){write(x),putchar(' ');}
    template<typename T> void write_n(T x){write(x),putchar('\n');}
}using namespace IO;

int n,ans;
ll ax,ay,bx,by,t;
struct node{ll x,y;}nod[N],st;

ll getdis(node a,node b){return std::abs(a.x-b.x)+std::abs(a.y-b.y);}

signed main(){
    nod[n=1]={read<ll>(),read<ll>()},ax=read<ll>(),ay=read<ll>(),bx=read<ll>(),by=read<ll>();
    st={read<ll>(),read<ll>()},t=read<ll>();
    while(nod[n].x<(INFLL-bx)/ax&&nod[n].y<(INFLL-by)/ay)
	    nod[++n]={ax*nod[n].x+bx,ay*nod[n].y+by};
    for(int i=1,j,res,ret;i<=n;++i){
        if(t-getdis(nod[i],st)<0) continue;
        for(ret=1,j=i,res=t-getdis(nod[i],st);j!=1&&getdis(nod[j-1],nod[j])<=res;)
            res-=getdis(nod[j-1],nod[j]),--j,++ret;
        if(getdis(nod[j],nod[i+1])<=res){
            res-=getdis(nod[j],nod[i+1]),++ret;
            for(j=i+1;getdis(nod[j+1],nod[j])<=res;)
            res-=getdis(nod[j+1],nod[j]),++j,++ret;
        }
        ans=max(ans,ret);
    }
    write_n(ans);
    return 0;
}

//~kawaii~
2022/3/29 15:25
加载中...