QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449240#8544. Colorful Graph 2ukukWA 0ms3524kbC++141.5kb2024-06-20 20:29:022024-06-20 20:29:02

Judging History

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

  • [2024-06-20 20:29:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-06-20 20:29:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define i64 long long
#define LL long long
#define i128 __int128
#define ull unsigned long long
#define db long double 
#define PII pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define lowbit(x) ((x)&-(x))
#define debug(x) cout<<(#x)<<" = "<<(x)<<'\n'

const double eps=1e-8;
const int mod=1e9+7;
//const int mod=998244353;
const int inf=1e9+7;
const i64 INF=1e9+7;
const int N=1e5+5;
const int M=1e6+5;

//const int g=3;
//const int gi=332748118;

LL qmi(LL a,int b){
	a=(a%mod+mod)%mod;
	LL ret=1;
	for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;
	return ret;
}
int Sqrt(int x){
	assert(x>=0);
	int t=sqrt(x);
	while((t+1)*(t+1)<=x)t++;
	while(t*t>x)t--;
	return t;
}



int n;
int m;
bool vis[M];

inline void solve(){
	cin>>n>>m;
	vector<int>po;
	for(int i=0;i<m;i++){
		int x,y;cin>>x>>y;
		po.pb(x);
		po.pb(y);
		vis[x]=vis[y]=1;
	}
	if(!m){
		for(int i=0;i<n;i++){
			if(i&1)cout<<"R";
			else cout<<"B";
		}
		cout<<'\n';
		return;
	}
	
	int p=0;
	while(!vis[p])p++;
	
	vector<int>ans(n);
	for(int i=1;i<n;i++){
		p++;
		ans[p%n]=ans[(p+n-1)%n];
		if(vis[p%n])ans[p%n]^=1;
	}
	
	for(int i=0;i<n;i++){
		if(ans[i])cout<<'R';
		else cout<<'B';
	}
	
	for(auto x:po)vis[x]=0;
	
	cout<<'\n';
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int _=1;
	cin>>_;
	while(_--)solve();
	return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3524kb

input:

3
3 0
4 1
1 3
6 3
0 2
2 4
4 0

output:

BRB
RBBR
BBRRBB

result:

wrong answer cycle detected (test case 3)