QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#875440 | #10043. Mod Graph | rotcar07 | Compile Error | / | / | C++14 | 1.1kb | 2025-01-29 19:41:57 | 2025-01-29 19:41:57 |
Judging History
This is the latest submission verdict.
- [2025-01-29 19:41:57]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-29 19:41:57]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int N=5e4+5;
int n,q,m,a[N],B,col[N];
vector<int> e[N];bool f=1;
void dfs(int p,int c){
if(~col[p]){
if(col[p]!=c) f=0;
return;
}col[p]=c;
for(int x:e[p]) dfs(x,c^1);
}
int main(){
cin>>n>>m>>q;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1,x;i<=n;i++)cin>>x,B=gcd(B,x),col[i]=-1;
for(int i=1,u,v;i<=m;i++) cin>>u>>v,e[u].emplace_back(v),e[v].emplace_back(u);
for(int i=1;i<=n&&f;i++) if(!~col[i]) dfs(i,0);
int w=0;
if(f)
for(int i=1;i<=n;i++){
if(col[i])(w+=a[i])%=B;
else (w-=a[i])%=B;
}
while(q--){
int op,x,y;cin>>op>>x;
if(op==1){
bool sb=1;
if(n==1) sb=(a[1]+1==B);
else if(f){
int ww=(w+B+col[x])%B;
sb=(ww==0||ww==1);
}
puts(sb?"YES":"NO");
}
else{
cin>>y;
if(col[x]) (w+=y-a[x])%=B;
else (w-=y-a[x])%=B;
a[x]=y;
}
}
}
詳細信息
answer.code: In function ‘int main()’: answer.code:16:37: error: ‘gcd’ was not declared in this scope 16 | for(int i=1,x;i<=n;i++)cin>>x,B=gcd(B,x),col[i]=-1; | ^~~