QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601934 | #8544. Colorful Graph 2 | ucup-team4153 | WA | 0ms | 3632kb | C++17 | 1012b | 2024-09-30 16:14:45 | 2024-09-30 16:14:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
bool vis[N];
char res[N];
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--){
int n,m;
cin>>n>>m;
for(int i=0;i<n*2;i++)vis[i]=false;
for(int i=0;i<m;i++){
int u,v;cin>>u>>v;
vis[u]=vis[v]=true;
}
if(n&1){
int l;
for(int i=0;i<n;i++){
if(!vis[i]){
l=i;
break;
}
}
res[l]='B';
for(int i=1;i<n;i++){
if(i&1)res[(l+i)%n]='B';
else res[(l+i)%n]='R';
}
for(int i=0;i<n;i++)cout<<res[i];
}else{
for(int i=0;i<n;i++){
if(i&1)cout<<'R';
else cout<<'B';
}
}
cout<<'\n';
}
return 0;
}
/*
4 2 7
1 2 0
2 3 0
3 4 0
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
BBR BRBR BRBRBR
result:
wrong answer cycle detected (test case 3)