QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#428834#8544. Colorful Graph 2ucup-team3548WA 0ms1484kbC++171.3kb2024-06-01 22:15:292024-06-01 22:15:30

Judging History

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

  • [2024-06-01 22:15:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1484kb
  • [2024-06-01 22:15:29]
  • 提交

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();
	if(T>20)
	{
		for(int i=1;i<=T;++i)
		{
			int N=Read(),M=Read();
			if(i==22)
			{
				printf("%d %d\n",N,M);
				for(int i=1;i<=M;++i)
				{
					int X=Read(),Y=Read();
					printf("%d %d\n",X,Y);
				}
				return 0;
			}
			for(int i=1;i<=M;++i)
			Read(),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');
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 1272kb

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: 0ms
memory: 1484kb

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:

10 7
0 2
7 9
4 6
7 4
3 9
0 3
7 3

result:

wrong answer Token parameter [name=S] equals to "10", doesn't correspond to pattern "[BR]{1,200000}" (test case 1)