QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#785655 | #9810. Obliviate, Then Reincarnate | Tom22l | Compile Error | / | / | C++17 | 1.6kb | 2024-11-26 18:41:53 | 2024-11-26 18:41:57 |
Judging History
This is the latest submission verdict.
- [2024-11-26 23:19:26]
- hack成功,自动添加数据
- (/hack/1260)
- [2024-11-26 18:41:57]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-26 18:41:53]
- Submitted
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int Read(){
int x=0;
char ch=getchar();bool f=0;
while(ch<'0'||ch>'9') if(ch=='-')f=1,ch=getchar(); else if(ch==EOF)return 0; else ch=getchar();
while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
return f?-x:x;
}
int h[1000005];
int nxt[1000005];
int to[1000005];
int cnt;
int ans[1000005];
void link(int x,int y){
nxt[++cnt]=h[x];
h[x]=cnt;
to[cnt]=y;
return ;
}
bool vis[500005];
int pth[500005];
int n,m,q;
int dfs(int x,int res){
// cout<<x<<':'<<endl;
vis[x]=1;
for(int i=h[x];i;i=nxt[i]){
int y=to[i];
int k=((x+y)%n+n)%n;
// cout<<y<<' '<<k<<endl;
if(ans[k]==1){
ans[x]=1;
return 1;
}
if(ans[k]==res){
if(pth[k]!=pth[x]+y){
pth[k]=pth[x]+y;
ans[k]=1;
dfs(k,res);
return 1;
}
}
if(ans[k])continue;
if(vis[k]){
if(pth[x]-pth[k]+y){
// cout<<x<<' '<<k<<' '<<pth[x]<<' '<<pth[k]<<' '<<y<<endl;
ans[k]=1;ans[x]=1;return 1;
}else{ans[k]=res;ans[x]=res;continue;}
}
pth[k]=pth[x]+y;
int yeu=dfs(x);
if(yeu==1){
ans[x]=1;return 1;
}else if(yeu==res) ans[x]=res;
}ans[x]=(ans[x]?ans[x]:2);
// cout<<"end";
return ans[x];
}
int ccnt=3;
signed main(){
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
n=Read(),m=Read(),q=Read();
while(m--){
int x=Read(),y=Read();
x=(x%n+n)%n;
link(x,y);
}
for(int i=0;i<n;i++){
if(!ans[i]){
dfs(i,++ccnt);
}
}while(q--){
int x=Read();x=(x%n+n)%n;
if(ans[x]==1) printf("Yes\n");
else printf("No\n");
}
return 0;
}
详细
answer.code: In function ‘long long int dfs(long long int, long long int)’: answer.code:37:34: error: expected ‘)’ before ‘!’ token 37 | if(pth[k]!=pth[x]+y){ | ~ ^ | ) answer.code:39:39: error: expected ‘;’ before ‘=1’ 39 | ans[k]=1; | ^~~ | ; answer.code:49:37: error: expected ‘;’ before ‘=res’ 49 | }else{ans[k]=res;ans[x]=res;continue;} | ^~~~~ | ; answer.code:53:20: error: ‘yeu’ was not declared in this scope 53 | if(yeu==1){ | ^~~ answer.code: In function ‘int main()’: answer.code:72:33: error: ‘ccnt’ was not declared in this scope; did you mean ‘cnt’? 72 | dfs(i,++ccnt); | ^~~~ | cnt