QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#601934#8544. Colorful Graph 2ucup-team4153WA 0ms3632kbC++171012b2024-09-30 16:14:452024-09-30 16:14:46

Judging History

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

  • [2024-09-30 16:14:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-09-30 16:14:45]
  • 提交

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)