QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#572643 | #8544. Colorful Graph 2 | wangjingheng | Compile Error | / | / | C++14 | 715b | 2024-09-18 15:48:03 | 2024-09-18 15:48:04 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve(){
int n,m;cin>>n>>m;
vector<pair<int,pair<int,int> > > g;
for(int i=1;i<=m;i++){
int u,v;cin>>u>>v;
int x=(u-v)%n;
x=(x+n)%n;
int y=(v-u)%n;
y=(y+n)%n;
if(x<=y){
g.push_back({x,{v,u}});
}
}
sort(g.begin(),g.end());
for(auto [_,e]:g){
auto [u,v]=e;
if(c[u]&&c[v]) continue;
if(c[u]){
c[v]=3-c[u];
}
else if(c[v]){
c[u]=3-c[v];
}
else{
c[u]=1,c[v]=2;
}
}
for(int i=0;i<n;i++){
if(c[i]==1){
cout<<"B";
}
else{
cout<<"R";
}
cout<<"\n";
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int T;cin>>T;
while(T--)
solve();
}
Details
answer.code: In function ‘void solve()’: answer.code:18:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 18 | for(auto [_,e]:g){ | ^ answer.code:19:22: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 19 | auto [u,v]=e; | ^ answer.code:20:20: error: ‘c’ was not declared in this scope 20 | if(c[u]&&c[v]) continue; | ^ answer.code:21:20: error: ‘c’ was not declared in this scope 21 | if(c[u]){ | ^ answer.code:32:20: error: ‘c’ was not declared in this scope 32 | if(c[i]==1){ | ^