QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#787731 | #8544. Colorful Graph 2 | DepletedPrism# | WA | 0ms | 3584kb | C++23 | 1012b | 2024-11-27 14:17:08 | 2024-11-27 14:17:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long ha(int x,int y){
return x*200003ll+y;
}
int main(){
int T;
cin>>T;
while(T--){
int n;
cin>>n;
int m;
cin>>m;
unordered_map<long long,int> mp;
vector<int> vis(n+1);
for(int i=1;i<=m;i++){
int x,y;
cin>>x>>y;
vis[x]++;
vis[y]++;
}
if(n%2==0){
for(int i=1;i<=n;i++){
if(i&1){
cout<<"R";
}else{
cout<<"B";
}
}
}else{
int pos=0;
for(int i=0;i<n;i++){
if(!vis[i]){
pos=i;
break;
}
}
vector<char> vec(n+1);
vec[pos]='R';
char now='R';
for(int i=(pos+1)%n;i!=pos;i=(i+1)%n){
vec[i]=now;
if(now=='B'){
now='R';
}else{
now='B';
}
}
for(int i=0;i<n;i++){
cout<<vec[i];
}
}
cout<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
RRB RBRB RBRBRB
result:
wrong answer cycle detected (test case 3)