QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#572643#8544. Colorful Graph 2wangjinghengCompile Error//C++14715b2024-09-18 15:48:032024-09-18 15:48:04

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 15:48:04]
  • 评测
  • [2024-09-18 15:48:03]
  • 提交

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){
      |                    ^