QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#554156 | #8544. Colorful Graph 2 | ucup-team1231# | WA | 0ms | 3740kb | C++17 | 491b | 2024-09-09 08:01:34 | 2024-09-09 08:01:35 |
Judging History
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)