QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#554156#8544. Colorful Graph 2ucup-team1231#WA 0ms3740kbC++17491b2024-09-09 08:01:342024-09-09 08:01:35

Judging History

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

  • [2024-09-09 08:01:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-09-09 08:01:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define SZ 1234567
int T,n,m;
void sol() {
    scanf("%d%d",&n,&m);
    int ans=2e9,U=0;
    for(int i=1;i<=m;++i) {
        int u,v;
        scanf("%d%d",&u,&v);
        int d=(v-u+n)%n;
        if((u-v+n)%n<d) swap(u,v);
        d=(v-u+n)%n;
        if(d<ans) ans=d,U=u;
    }
    for(int i=0;i<n;++i)
        printf("%c","BR"[(i-U-1+n)%n%2]);
    printf("\n"); 
}
int main() {
    scanf("%d",&T);
    while(T--) sol();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

BBR
BRBR
RBRBRB

result:

wrong answer cycle detected (test case 3)