QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#428828 | #8544. Colorful Graph 2 | ucup-team3548 | WA | 12ms | 1320kb | C++17 | 1.0kb | 2024-06-01 22:09:17 | 2024-06-01 22:09:18 |
Judging History
answer
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int Read()
{
int Output=0;
char Input=getchar();
while(Input<'0'||Input>'9')
Input=getchar();
while(Input>='0'&&Input<='9')
{
Output=Output*10+Input-'0';
Input=getchar();
}
return Output;
}
int T;
int Line[200001];
bool State[200001];
int main()
{
T=Read();
while(T--)
{
int N=Read(),M=Read();
for(int i=0;i<N;++i)
Line[i]=State[i]=0;
int Min=N+1,Max=-1;
for(int i=1;i<=M;++i)
{
int X=Read(),Y=Read();
++Line[X],++Line[Y];
Max=max(Max,max(X,Y));
Min=min(Min,min(X,Y));
}
if(Max==-1)
{
for(int i=1;i<N;++i)
putchar('B');
putchar('R');
putchar('\n');
continue;
}
bool Now=0;
for(int i=0;i<N;++i)
if(Line[i])State[i]=Now,Now=!Now;
if(State[Min]==State[Max])
{
if(Min>0)State[Min-1]=!State[Min];
else if(Max<N-1)State[Max+1]=!State[Min];
}
for(int i=0;i<N;++i)
putchar(State[i]?'B':'R');
putchar('\n');
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1312kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
BBR RRRB RRBRRB
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 12ms
memory: 1320kb
input:
100000 9 6 2 0 4 6 3 6 0 6 0 7 2 6 3 0 5 2 2 4 2 0 6 3 1 5 4 1 2 4 9 6 3 1 6 4 8 1 3 6 1 6 8 6 3 0 7 4 3 0 4 0 6 4 3 1 7 4 5 1 5 0 3 1 1 4 4 1 1 3 6 3 2 4 4 0 2 0 6 3 3 0 1 3 5 3 7 4 0 5 2 5 5 1 3 5 8 5 4 1 5 1 5 0 1 3 5 7 3 0 8 5 0 2 4 6 0 6 0 3 4 0 8 5 5 1 1 4 5 0 3 1 5 7 3 0 10 7 0 2 9 2 5 8 3 9 ...
output:
RRBRBRRBR BBR RRBRR RRBRRB BRRBRRBRR BBR RBRRBRR RBRRBRB RRRB RRBRRB RBRRRB RBRBRRB RBRRBRRB BBR RRBRBRRB RBRRBRRB BBR RRBRBRBRRB BRRBRRBR RRBRBRRBRB RRBRBRRBRB RRBRBRRBRR BBR RRBRRRB RRRBRB RRBRRBRB RRRB RRBRRBR RRBRBRRBRB BRBRRBR BRBRRRBR RRRBRB RRBRRB BBR BBR RRRBRRBRB RBRRBRR RBRRB BRBRRBRRBR RB...
result:
wrong answer cycle detected (test case 22)