QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#787731#8544. Colorful Graph 2DepletedPrism#WA 0ms3584kbC++231012b2024-11-27 14:17:082024-11-27 14:17:18

Judging History

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

  • [2024-11-27 14:17:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-11-27 14:17:08]
  • 提交

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)