QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#309745#8128. Alternating Pathsucup-team266#WA 803ms3844kbC++202.8kb2024-01-20 20:21:462024-01-20 20:21:46

Judging History

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

  • [2024-01-20 20:21:46]
  • 评测
  • 测评结果:WA
  • 用时:803ms
  • 内存:3844kb
  • [2024-01-20 20:21:46]
  • 提交

answer

/*
Things to notice:
1. do not calculate useless values
2. do not use similar names
 
Things to check:
1. submit the correct file
2. time (it is log^2 or log)
3. memory
4. prove your naive thoughts 
5. long long
6. corner case like n=0,1,inf or n=m
7. check if there is a mistake in the ds or other tools you use
8. fileio in some oi-contest

9. module on time 
10. the number of a same divisor in a math problem
11. multi-information and queries for dp and ds problems
*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
const int mod=998244353;
const int inf=0x3f3f3f3f;
int n,m,U[305],V[305],col[305],perm[305];
int fa[105];
int find(int x)
{
	if(fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}
void merge(int x,int y)
{
	int xx=find(x),yy=find(y);
	if(xx!=yy) fa[xx]=yy;
}
mt19937 rnd(114514);

int vis[105][2];
vector <pii > g[105];
bool chk()
{
	for(int i=1;i<=n;i++) g[i].clear();
	for(int i=1;i<=m;i++) g[U[i]].pb(mp(V[i],col[i])),g[V[i]].pb(mp(U[i],col[i]));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++) vis[j][0]=vis[j][1]=0;
		vis[i][0]=vis[i][1]=1;
		queue <pii > q;
		q.push(mp(i,0)),q.push(mp(i,1));
		while(q.size())
		{
			int u=q.front().fi,c=q.front().se;
			q.pop();
			for(int j=0;j<g[u].size();j++) if(g[u][j].se!=c)
			{
				int v=g[u][j].fi;
				if(vis[v][c^1]) continue;
				vis[v][c^1]=1,q.push(mp(v,(c^1)));
			}
		}
		for(int j=1;j<=n;j++) if(!vis[j][0]&&!vis[j][1]) return 0;
	}
	return 1;
}
int tr[305],dep[305];
void dfs0(int u,int par)
{
	for(int i=0;i<g[u].size();i++)
	{
		int v=g[u][i].fi;
		if(v==par) continue;
		dep[v]=dep[u]+1,dfs0(v,u);
	}
}
bool work()
{
	for(int i=1;i<=n;i++) fa[i]=i,g[i].clear(),dep[i]=0;
	for(int i=1;i<=m;i++) perm[i]=i,tr[i]=0;
	for(int i=m;i>=1;i--) swap(perm[i],perm[1+rnd()%i]);
	for(int i=1;i<=m;i++) 
	{
		int x=perm[i];
		if(find(U[x])!=find(V[x])) merge(U[x],V[x]),tr[x]=1,g[U[x]].pb(mp(V[x],x)),g[V[x]].pb(mp(U[x],x));
	}
	dfs0(1+rnd()%n,-1);
	for(int i=1;i<=m;i++)
	{
		if(tr[i]) col[i]=min(dep[U[i]],dep[V[i]])%2;
		else
		{
			col[i]=rnd()%2;
			int x=U[i],y=V[i];
			if(rnd()%2) swap(x,y);
			col[i]=(dep[x]%2)^1;
		}
	}
//	for(int i=1;i<=m;i++) cout<<col[i];
//	cout<<"\n";
//	system("pause");
	if(chk())
	{
		for(int i=1;i<=m;i++) cout<<(col[i]?"R":"B");
		cout<<"\n";
		return 1;
	}
	return 0;
}
void solve()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>U[i]>>V[i];
	for(int _=0;_<30000;_++) if(work()) return;
	cout<<"IMPOSSIBLE\n";
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int _=1;
	cin>>_;
	while(_--) solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 3516kb

input:

3
6 6
1 2
2 3
3 1
4 1
5 2
6 3
6 6
1 2
2 3
3 1
3 4
4 5
4 6
4 3
1 2
4 2
2 3

output:

BBRBRB
BRRBRR
IMPOSSIBLE

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

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

output:

RBBRBR

result:

ok ok (1 test case)

Test #3:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

1
5 6
1 2
1 3
1 5
2 4
2 5
3 4

output:

BBRRRB

result:

ok ok (1 test case)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1
5 8
1 2
1 4
1 5
2 3
2 4
2 5
3 4
4 5

output:

BRBBBBBB

result:

ok ok (1 test case)

Test #5:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

1
7 12
1 2
1 3
1 6
2 3
2 5
2 7
3 4
3 5
3 6
4 6
4 7
5 7

output:

BRRBBBBRBBRB

result:

ok ok (1 test case)

Test #6:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

1
7 13
1 2
1 3
1 4
1 6
1 7
2 5
3 5
3 7
4 6
4 7
5 6
5 7
6 7

output:

BRRRBBBRRRRBB

result:

ok ok (1 test case)

Test #7:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

1
4 5
1 2
1 3
1 4
2 3
2 4

output:

RRBRR

result:

ok ok (1 test case)

Test #8:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

1
5 7
1 2
1 4
2 3
2 4
3 4
3 5
4 5

output:

RBBRRBB

result:

ok ok (1 test case)

Test #9:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

1
5 7
1 2
1 5
2 3
2 5
3 4
3 5
4 5

output:

RRBBRBB

result:

ok ok (1 test case)

Test #10:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

1
6 6
1 2
1 4
2 3
2 6
3 5
4 5

output:

BRRRRB

result:

ok ok (1 test case)

Test #11:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1
6 10
1 2
1 3
1 5
1 6
2 4
3 4
3 5
3 6
4 5
4 6

output:

BBRRRRBRBR

result:

ok ok (1 test case)

Test #12:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

1
9 14
1 2
1 5
1 8
2 3
2 4
3 6
3 9
4 6
4 7
4 8
5 7
5 8
6 8
7 8

output:

BBRRRRBRRRRBBB

result:

ok ok (1 test case)

Test #13:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

1
7 12
1 2
1 3
1 4
1 6
1 7
2 5
2 7
3 4
3 6
3 7
4 5
5 6

output:

RBRBRRRBRBBR

result:

ok ok (1 test case)

Test #14:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

1000
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
2 1
1 2
2 1
1 2
2 1
1 2
2 1
1 2
2 1
1 2
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
2 1
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1...

output:

B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
...

result:

ok ok (1000 test cases)

Test #15:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
2 1
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RRB
RB
BR
RRB
RBR
BBB
BR
RRB
BR
BBB
BR
BR
RB
RB
RBR
BR
BRR
BR
RB...

result:

ok ok (1000 test cases)

Test #17:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

1000
3 3
3 2
2 1
3 1
3 2
1 3
2 1
3 2
1 2
3 2
3 3
3 1
1 2
2 3
3 2
3 1
2 3
3 3
1 2
1 3
2 3
3 2
1 3
3 2
3 3
2 3
3 1
1 2
3 3
3 1
2 1
2 3
3 2
1 3
3 2
3 3
2 3
1 3
2 1
3 2
2 1
3 1
3 3
3 1
1 2
3 2
3 3
3 1
3 2
2 1
3 2
1 3
2 3
3 2
3 2
2 1
3 3
1 3
1 2
3 2
3 3
2 1
1 3
3 2
3 2
1 3
1 2
3 3
2 1
3 1
2 3
3 3
3 2
1 2...

output:

BBB
RB
RB
RRB
BR
BBB
BR
BBB
BRR
RB
RRB
BR
BRR
BRR
RB
BR
RBR
RBR
BR
BRR
BBB
BBB
RB
RB
RB
BR
RB
BRR
BBB
RBR
BR
RB
BR
BR
RB
BBB
BR
BRR
RRB
BR
BBB
BR
RRB
BRR
BBB
RB
BBB
RB
BBB
RBR
RB
BR
BRR
RBR
RBR
RBR
BBB
BR
BBB
BRR
RB
RRB
BRR
RRB
BBB
RB
BR
RBR
BR
BBB
RBR
BR
RBR
RRB
RB
BR
BBB
RB
BRR
BBB
RBR
BRR
RBR
BR
...

result:

ok ok (1000 test cases)

Test #18:

score: 0
Accepted
time: 456ms
memory: 3628kb

input:

1000
4 4
2 1
4 2
3 2
1 3
4 4
2 1
1 4
2 4
2 3
4 5
1 3
2 4
1 2
1 4
3 2
4 3
3 4
1 4
4 2
4 6
1 4
3 1
4 2
1 2
4 3
3 2
4 3
1 3
4 3
2 3
4 3
3 2
4 2
2 1
4 5
1 3
2 4
4 3
2 3
1 4
4 4
1 4
3 2
3 4
2 1
4 6
3 4
4 2
2 1
4 1
1 3
3 2
4 6
4 2
1 4
2 3
4 3
2 1
3 1
4 6
4 1
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)

Test #20:

score: 0
Accepted
time: 557ms
memory: 3628kb

input:

1000
5 8
5 1
4 5
2 4
3 2
2 1
5 3
1 3
3 4
5 9
2 4
4 5
5 2
1 5
3 1
3 5
4 1
4 3
1 2
5 5
1 4
3 1
1 5
5 2
4 2
5 9
1 2
5 4
4 3
4 2
4 1
5 3
1 5
5 2
2 3
5 9
3 4
3 2
2 5
3 1
4 5
5 3
4 1
1 5
4 2
5 10
3 5
2 1
2 5
5 4
1 3
4 2
1 4
5 1
2 3
4 3
5 5
3 4
5 3
5 1
5 4
2 5
5 6
1 2
2 4
1 5
3 2
3 1
3 4
5 8
4 2
4 3
1 2
1 ...

output:

BRRRRRRB
BBBRBRBBB
BBRBR
BRRBBRBRR
BBRRBRBBB
BRRRRRRBBB
BRBRB
RBRRBR
BBBBBBRB
BRRB
RRBBBRBRR
BBRRR
BBRBRB
RBRRB
BRBBBBRRBB
BRBRB
BRRRRRBRB
BBRRBR
BBRBBB
RRRBBBRRBB
IMPOSSIBLE
BBBRBBB
RBBRRB
BRRBRBBRRR
BRBRBBBBR
IMPOSSIBLE
RRRRBRBRRB
RBRBRBRB
RRRRRRRBRR
IMPOSSIBLE
RRRRBBRBRB
RBBRRRBBR
RRBRRBRBR
BBRRR...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 568ms
memory: 3620kb

input:

1000
5 9
3 2
5 4
4 1
4 3
2 1
4 2
3 5
3 1
2 5
5 6
5 1
3 1
5 4
4 2
2 5
2 1
5 10
4 1
3 4
1 5
5 4
2 3
5 2
2 1
4 2
5 3
3 1
5 5
2 5
5 4
1 4
4 2
3 5
5 8
4 3
4 1
2 5
2 3
2 4
3 1
4 5
2 1
5 8
4 1
3 5
3 4
1 5
2 1
5 2
2 4
4 5
5 8
3 4
5 4
3 1
2 3
1 4
3 5
5 1
2 4
5 4
1 5
4 5
3 4
2 3
5 10
3 5
3 2
3 1
4 1
3 4
4 2
5...

output:

BBBBRRBRB
RBRBRR
BRRRBRBRRB
RRBRB
BRBBRBBB
BRBBBRRR
BRBBRBBB
RBRB
RBBBRRRRBB
BRRBR
BRRBBBB
BBBBBRBRBR
BRBBBRBB
BBRRBRRBR
RBRRBR
BBBBRBBB
RBRRBR
BBRBR
IMPOSSIBLE
RRBB
RRRBBB
IMPOSSIBLE
IMPOSSIBLE
BRBR
RBBR
BBRBBBBBRR
RBRRB
IMPOSSIBLE
BBRRBR
BBBBBBRR
IMPOSSIBLE
RBBBR
BRRBRBRBRR
BRRBBBRR
RBRRBB
BRRRRBR...

result:

ok ok (1000 test cases)

Test #22:

score: 0
Accepted
time: 509ms
memory: 3564kb

input:

1000
6 10
2 3
4 1
5 3
4 5
3 4
4 6
2 4
1 3
1 2
2 5
6 11
4 2
4 3
3 5
1 4
1 3
6 5
4 5
2 1
2 3
6 2
1 6
6 5
6 3
3 1
5 2
3 4
3 2
6 6
1 3
1 6
1 4
6 5
2 5
6 4
6 9
5 3
4 6
2 3
2 1
1 4
2 6
5 1
3 1
6 5
6 10
1 5
6 2
2 3
4 5
3 1
5 6
3 5
2 4
2 5
6 3
6 13
4 5
1 3
1 2
5 6
2 4
3 2
2 5
3 5
6 1
4 1
6 2
4 6
3 6
6 14
6 ...

output:

RBRBBRBBRR
BRRBBRBBRBB
IMPOSSIBLE
BRRBRR
RBBRBBBRB
RRRRRBRBBR
RRBRRRBRRRBBR
BRRBBBBBBBBBBR
RBRBBRBBBRR
BBRBRRBBR
RBRRBBRBRBRR
RBRBRBBRBBRB
BRRBBRBBRRBBRR
BRBBRRBBR
BBRBRRBBBRRB
RRBBRRRRRBRBRRR
BBBBRRBRRRBR
BBRBRBBRRR
RRBBBR
BRBBBRBRR
RBRBRBBRB
IMPOSSIBLE
BBRRBBRBBRBRB
IMPOSSIBLE
RRBRBBB
IMPOSSIBLE
I...

result:

ok ok (1000 test cases)

Test #23:

score: 0
Accepted
time: 797ms
memory: 3636kb

input:

1000
6 7
4 3
2 4
2 6
1 2
6 4
5 1
3 5
6 13
2 6
4 6
2 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BRBBBRRBBBBB
RBRBBBBRRBRRRRRBRRRRR
RBRBRRBRBBBRBRRR
BBRBBRRRBBRRBBRR
RRRBRBRRRRRRBBBRBRB
IMPOSSIBLE
RRBBRRRBB
IMPOSSIBLE
IMPOSSIBLE
RRRBBRRRRR
BBRRRRRRRRRRBR
RRRRBBB
BRRRRBRBBRBB...

result:

ok ok (1000 test cases)

Test #25:

score: 0
Accepted
time: 803ms
memory: 3828kb

input:

1000
7 15
3 6
6 4
7 2
4 1
6 1
5 4
3 4
2 1
6 7
3 2
3 1
3 7
2 6
2 5
7 1
7 18
4 7
6 2
1 4
6 4
7 5
6 1
3 2
3 1
3 4
5 2
2 1
4 5
5 1
1 7
6 7
2 7
4 2
3 7
7 15
7 2
7 4
6 3
2 5
3 4
6 2
5 3
7 6
6 4
1 3
1 7
1 6
3 2
4 1
4 5
7 16
6 1
4 6
2 5
1 4
6 3
3 1
1 7
5 4
5 3
7 6
5 6
4 7
5 7
2 6
1 2
2 4
7 11
5 2
1 5
6 2
7 ...

output:

BBRBBBRRBBBBRBB
BBBRRRBRBBBRBBRRBR
BRRRRRBRRRRRRRR
RRRRBBBRBBRBBBRR
BBBRBRRRBRB
RBRRBBRRRRRBRBRBBBRB
BRRBBBBRRBRBRBRB
RRBRRRRRRBRBRBBBBBB
BRRRRBRRBBRBBBRB
IMPOSSIBLE
RRBBRBBB
RBBRBRRRBBBBBRRBBBR
RRRRRRBRRRBRBRRBRB
IMPOSSIBLE
BBBBBRBBRBR
RBRBBRBRBRB
RRRBRRRRRBRB
BBRBRBRRRRBBBRRBBRBRR
RRBBBRBRBRRBBB
R...

result:

ok ok (1000 test cases)

Test #26:

score: 0
Accepted
time: 723ms
memory: 3560kb

input:

1000
8 12
1 6
7 2
7 8
5 2
8 4
8 1
8 5
2 6
1 5
3 6
4 7
8 3
8 28
2 3
5 4
8 4
8 2
4 6
1 2
6 5
2 6
5 8
7 1
1 6
2 5
3 1
7 2
4 3
3 6
8 7
4 2
5 7
8 1
5 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BRBBRRRRRRRRBRBR
RBBRBBBBRBBRRRBB
RBBBBRBRRRRBRRRRBBRRRRRRR
RRRRBBBBRR
RBBBRBRBBRBBBBR...

result:

ok ok (1000 test cases)

Test #28:

score: 0
Accepted
time: 797ms
memory: 3764kb

input:

1000
9 19
6 9
7 3
8 1
9 2
5 6
7 6
3 4
4 2
6 2
7 2
3 5
5 8
5 2
4 9
9 5
2 1
4 8
8 9
3 9
9 34
9 8
3 7
9 2
5 1
7 9
4 5
1 6
6 4
1 9
4 9
6 7
6 3
9 3
8 3
4 3
8 7
8 4
2 5
5 3
7 5
8 1
6 5
9 5
4 2
4 7
1 7
2 6
8 5
3 1
9 6
2 7
1 2
3 2
6 8
9 30
8 4
6 3
2 5
2 9
6 4
6 7
7 2
7 3
2 8
1 4
4 7
4 2
9 3
8 5
7 1
7 9
2 3
...

output:

RRBBRBRRRBRRBRBRRRB
RBRRBRRRRRRRRRRBRBRBRRRRRBRRRRBBRB
RRBRRBRRBBRRRBBRRBRBRRRRBRBRBR
BBBRBRRBBRRRRRBRBBBBRBBRBBBB
BBRRBRBBBRBRRBRBRRRBBBBRRBBR
BBRBBBBRRRRBBBBRRRBRBRBBBBRBRBBBR
RBBBBRBBRRBBRRRRBBRRRBRRBBRBRRBBRBB
BRBRBRBBBRBRBBRRRRRRRRBBRRBR
IMPOSSIBLE
BBBRRRRRRRRRBBRRRBRRBRB
BRRRBBRBBRRRBBBB
RBBRR...

result:

ok ok (1000 test cases)

Test #29:

score: 0
Accepted
time: 559ms
memory: 3840kb

input:

1000
9 17
8 3
9 7
3 5
2 8
9 5
2 5
1 9
8 7
1 7
4 7
3 2
2 1
3 9
8 5
6 8
8 4
9 4
9 36
4 3
9 1
8 2
3 2
7 4
2 7
3 6
9 5
7 5
6 7
6 8
4 1
5 3
2 1
1 5
2 6
4 6
2 5
8 3
7 3
1 8
4 9
1 6
3 1
7 1
9 8
8 7
8 5
4 8
6 9
5 6
4 2
5 4
3 9
2 9
7 9
9 27
6 1
6 3
1 5
7 1
7 2
3 7
2 5
5 9
4 2
7 5
7 6
3 1
7 9
4 8
1 4
4 3
8 1
...

output:

BBBRBBRRRBRRRBBRB
RRBBBBBRBBBRRBRBBRBRRRRRBRBRRRBRRRRB
RRRRBBBBBRRBBBRRRBRRBRRRBBB
IMPOSSIBLE
RBBRRBRBRRRRBBB
BRBBRRBBBRRRRBBRRBRRRBBRRRR
RBRRBBBRBRRRRRBBBR
RBRRBRRRBRBRBRRRBBRBBBBBBRRBRBBBBRR
RBBRBBRBRRR
RBBRBRBBRBRBBR
RRBRRBRRRBBRRBBRRRRRBRRRBRRRRRRB
RBRBBBBRBRBR
RRRRBRBRBRBBRBRRRRRRRRBB
RRBBBBBRB...

result:

ok ok (1000 test cases)

Test #30:

score: 0
Accepted
time: 798ms
memory: 3568kb

input:

1000
10 40
7 10
6 3
1 8
5 1
5 4
9 7
1 10
10 8
9 4
3 10
2 7
7 8
4 10
2 10
6 10
3 4
1 7
5 8
5 7
1 6
7 3
2 3
3 8
9 8
6 2
3 5
7 4
1 2
2 8
9 1
2 9
5 10
6 8
10 9
3 9
6 7
4 6
2 5
6 9
6 5
10 33
9 3
6 3
2 6
3 4
8 9
10 5
7 5
10 1
8 5
7 6
3 10
3 5
9 6
5 9
9 7
3 7
10 2
9 1
4 5
4 10
3 2
4 9
4 8
3 8
2 5
4 7
8 2
8...

output:

BBBRBBBRRRBBRRBRBBBBBRRRBRBRRBRRBRRBBRRB
RBRBRBBRBRRBBBRBRBRRBRBBRRBBRBBRB
RRRRBRRRRBBRBRRBBRBRBBBBRRRBRBRB
BBBBRBBBBBRBRBBBBBBRRRRBRRBBBBRBR
BBRBBBBRRRBBRBBBRBBBRBRBRRRBRR
RRRRBRBBRRBBBRRBRRBBRBRBBBBBRR
BBRBRRRRRRBRR
BRRRBRRBBRBRBRBRBBBBBBBRBBRRRRRRBRBBRBBBB
RRBRBRRRBBBRRRBBRBB
RBRBRRRBBBRBBRRBBRBR...

result:

ok ok (1000 test cases)

Test #31:

score: 0
Accepted
time: 610ms
memory: 3788kb

input:

1000
10 24
2 7
3 9
5 2
5 1
6 4
6 5
6 10
7 9
5 7
8 1
4 7
10 8
3 7
10 7
9 1
5 9
9 2
2 4
10 1
8 2
8 6
2 1
9 4
5 4
10 42
2 1
3 8
7 3
4 6
7 1
2 5
7 5
4 1
10 9
2 10
2 3
3 5
6 7
1 9
8 5
7 8
10 5
1 8
1 6
10 3
6 8
8 9
1 5
3 1
2 4
4 7
9 7
4 10
5 4
10 6
10 1
2 9
8 10
7 10
3 9
7 2
6 3
9 5
3 4
2 6
9 6
4 8
10 21
...

output:

RBRRBRRBBRBRRRBBBRBRBRRR
BBBBBRRBBRBRRBRRRRBRRRRBBRRBBBBRRRBRBRBRBB
BBRBBBBBBRBBRRBBBBBBB
BBRBRBBRRRRRBRBBBBRRBRRBBRBRBBRRBBBRRRBB
BRBBRBBRRBBBBBBBBBBBBBBBRBBBB
BRBBBBBBBRBBBBRBRRRBR
BBRBRBBBRRRBRBRRRRRRBRBRRRBBBBBRRRBBRBBBBRB
RRBRRRRBRRRBBBBBRR
BBBRBBRRRRBRRRB
BBBBBBBRBBRRBBRBBBBBRBRRRBBRBBBRR
BRBR...

result:

ok ok (1000 test cases)

Test #32:

score: 0
Accepted
time: 715ms
memory: 3612kb

input:

1000
11 50
5 1
1 10
5 7
11 1
7 8
5 2
5 11
10 9
2 4
10 7
3 1
3 11
3 6
2 10
9 4
9 5
10 3
8 4
11 4
7 11
10 8
5 10
9 7
6 5
4 7
9 3
9 2
10 11
9 6
7 1
2 8
2 11
11 8
3 5
1 9
6 1
4 5
4 3
4 1
10 4
9 8
6 7
8 3
6 2
2 3
2 1
3 7
6 8
6 10
2 7
11 32
3 2
5 8
5 3
3 8
3 11
1 3
11 8
5 7
7 9
10 1
10 11
7 10
9 2
6 9
10 ...

output:

RRRBRRBRBBBBRBRRBBBBBRRRRRRBRRBBBBRRBBRBBRBBBRBRBB
RRBBBBRRRBRBRBBBRRBBRRBBBBRRBRBR
BBRBBBRRRBBBBBBRBBRBRRRBBRBBBBBBRBBB
RRRRRRRBRRRRBRRBRRRRBBBRRRBBBRBRRBBBRRRRBRR
RRRBBRRBRBRBBRRRRBRRRRRBBRRBRBBRRBRBRRBBR
RBBRBBBBRBRBRBRRBRRBBBRBRRBBBRBBRRRRBR
RRBRBRRRBBRBRRRBRRRRBBBBRRRBRBRRBRRRRBRBRRBBRRRBR
IMPO...

result:

ok ok (1000 test cases)

Test #33:

score: 0
Accepted
time: 631ms
memory: 3580kb

input:

1000
11 29
3 5
10 9
11 5
8 9
5 1
4 11
4 10
7 11
3 2
11 6
4 7
6 3
8 2
1 10
7 9
6 1
9 3
11 8
7 2
4 2
2 10
1 8
4 9
4 3
6 5
1 7
1 4
10 8
1 2
11 39
7 1
7 11
8 4
5 9
10 9
3 10
7 10
3 11
9 1
5 1
5 2
1 3
8 7
6 11
5 11
6 3
11 1
9 8
4 2
11 8
11 9
4 7
2 7
10 5
2 3
5 7
4 5
6 5
3 7
10 4
6 1
8 10
5 8
3 4
7 9
1 8
...

output:

BRBRRBBBRBRRRRRBBBRBRRBBBRBRB
RRRBBBBRRRRBRBRBRBBRBRRBBRRRBRBRRRBRRRR
BRBBRBBBRRRBRBBBRBBBBRBRRBRBRBRRBBRBRRRRBBBBR
BBBBBRRRBBBRBRRBRRBRRRRBBRBBBRBRBRRBRB
RBRRBRRBBRBBRRRBB
RRBRRRBRBRBBRRRBBRBBRB
BBRBBRBRRRBRBRRRBBBBRRRBRBRBRBBRBRRRBBBBRBRBBRRBR
RBRRBRBRRRBBBRBRBBRBR
RRRBBRRBBRRBBBBRRBBRBBRBBRRRBBBB...

result:

ok ok (1000 test cases)

Test #34:

score: 0
Accepted
time: 668ms
memory: 3768kb

input:

1000
12 25
6 9
3 1
6 10
11 6
12 1
7 8
11 12
6 5
4 1
5 4
7 5
6 7
8 1
6 2
12 4
10 11
9 12
2 9
8 4
7 3
6 1
6 8
7 2
11 3
5 12
12 25
8 5
1 8
2 12
5 1
7 5
8 4
1 11
6 7
7 4
4 1
12 10
8 11
12 6
8 2
6 10
10 9
6 2
7 10
4 3
9 6
10 2
5 2
11 12
1 7
9 5
12 24
6 8
7 8
12 10
4 10
12 5
8 12
3 1
1 11
12 3
4 5
1 5
11 ...

output:

BRBRBBRRBRRBRBBBBBRRRRRRB
RRBRBRRRRRBRBRRRRRBBBRRBB
BBRBRBRBRBRRRBRBRRBRRBRR
RRRRRRBBBRRRRRBBBBBBRRRRRBRBBBBBBBBBBBBRBBRRBRRBRBRRBBRBR
RRRBRRRRRBRRBBBBBRBBBRRBRRBBBBRRRBRBRRBBBRRRBBBRBB
RRRRRRBBBBBBBBBBRRRRRRBBRBBRBBBRRRBBB
BBBBRRRRRRRBRBRRBBRBBBBRRRBRRBRRRB
BRRRBBRRRRBRRRRRBBBBRRRBBRRRBBBRBR
BBBRBB...

result:

ok ok (1000 test cases)

Test #35:

score: 0
Accepted
time: 598ms
memory: 3844kb

input:

1000
12 52
7 9
4 7
2 8
10 11
4 2
1 4
9 1
10 5
1 10
9 2
3 11
8 6
5 7
3 7
6 1
5 9
10 9
2 7
5 4
3 4
2 10
12 6
5 1
2 3
12 11
5 6
3 10
3 1
4 11
7 1
6 2
9 12
3 6
12 2
5 11
12 7
1 8
1 2
11 7
12 8
6 9
3 9
8 5
1 12
3 5
6 10
6 4
3 12
10 8
8 9
6 11
12 5
12 49
12 1
5 2
8 6
11 6
7 9
6 4
11 5
12 2
7 3
5 1
12 9
4 ...

output:

RRRRRRRRRBRRRRBRRRRBRRRBRRBBRRBRBRRRRBRRBRRRRRRBRRRR
RRBBRBRRBRRBBBBRBBBBBRBBBBRRRBRBBBBBRBBRRRBBBBBBB
RBRRRRRBBBBBBRRRRRBRRBBRRBRBBBRBBRRBBBRRBRBRB
BBRRRRRRRBBBRBBBBBRBRBBRBBRBBRRBBRRRBR
RRRBRBBRRBBBRRBBRBRRBBRRRBBB
BRRBBRRBBRRBRBRBBBRBBBRRRBRRBRBBBBBBRRRRRRBRRRBRRRRRBBBBBR
RRBBRRRRBRRRRRBB
BBRBBBB...

result:

ok ok (1000 test cases)

Test #36:

score: 0
Accepted
time: 786ms
memory: 3624kb

input:

1000
13 28
8 2
11 13
9 11
1 8
7 8
5 8
2 13
13 9
11 3
11 7
4 5
4 7
10 12
8 13
7 13
6 3
3 5
6 12
7 2
4 13
7 3
8 12
10 2
6 9
4 11
10 11
1 5
3 13
13 19
12 11
7 8
4 5
6 9
10 13
8 2
10 6
7 13
10 3
2 4
4 13
7 2
5 3
5 1
3 7
12 5
8 5
12 8
9 8
13 40
7 13
13 4
12 11
8 9
3 6
12 6
5 12
9 11
2 12
8 1
3 4
6 1
13 1...

output:

BBRBBRBRBBRBRRBRBRBRRBBRBBBB
BBBBRBBBBBRRBRRRBRR
BBBRRRBRBBRRBBRRRRBRBRRBBBBBRRRBRBBRBRRR
BBRBBRBRRBRRRRRRRBBRBBRRBBBRRBRBBBRRRBRRBR
BRRRBBRBBBBBRRRBRBBRBRRBRRRRBBRRBRRRBRRRRBRRRRRRRRRRRRBRBBBRRBRBBBBRRBRB
BBRRBBBRBRRRBBBBBBRRBBRRRBRBRRRBRRRBBRRBBRBBBRBRRBRBRRRRRRRBBBRRRB
BRRBRBBRRRRBRRBBBBRBBBRRBRB...

result:

ok ok (1000 test cases)

Test #37:

score: 0
Accepted
time: 571ms
memory: 3844kb

input:

1000
13 70
8 2
8 12
13 1
2 10
13 2
7 3
5 4
8 7
7 9
10 4
11 6
1 12
12 13
1 5
1 9
12 9
3 2
12 2
6 13
13 11
12 3
1 11
8 6
8 4
7 13
7 6
10 11
9 11
11 7
5 9
11 2
8 13
8 5
8 1
9 6
2 9
2 6
8 11
9 13
11 5
12 11
13 3
7 5
13 10
6 10
4 11
8 10
7 2
6 4
3 9
3 5
4 9
6 3
5 13
4 2
10 7
10 9
4 12
8 9
2 1
7 1
3 8
3 1...

output:

BRBBBBRBBRRBRBRRBRBBRBBBBBBBBBBBBBRBRBRBBBBBRRBBRBBRBBBRRRRBBBRRBRBBBR
BBBRBBRBRBRRBRRRRBRRRRRBRRBRBRRRBRBRRRRBRBRBBBBRRBRRBBRBRRRBBRRBRB
RBBRBRRRBRRBRBBRRRBRBBRRBRBRBRBBRRBRB
IMPOSSIBLE
RBBBBRRBRBRRRBBBRBBBRBRBRBRBBBBBRBBBBRBRBBBRRBRBRRRRRRBRBBBBRBRBBBB
BBRRBRBBBRBBRRBBBBBRRBRBRBRRB
BBBBBBBBBBRRRRR...

result:

ok ok (1000 test cases)

Test #38:

score: 0
Accepted
time: 532ms
memory: 3560kb

input:

1000
14 89
8 6
14 12
3 2
14 7
14 4
11 10
5 14
9 13
3 9
12 2
2 8
1 11
11 5
3 1
14 1
8 5
4 9
12 11
13 2
10 6
12 10
11 13
8 3
11 2
9 11
8 13
7 1
4 1
7 2
4 6
5 4
11 14
7 13
8 12
1 10
5 2
6 7
4 11
10 5
9 12
1 13
13 10
7 4
12 13
6 13
9 5
3 12
10 2
6 2
7 5
10 7
13 5
8 9
14 8
10 4
14 9
6 9
2 9
3 4
4 13
9 1
...

output:

RBBBBRBBBBBRBRRBBBBRBBBRRBRRRBBBRBRBRRRBBBBBBBBRBBRBBBBBBBBBRRBBBRBBBRBRBBRBBBRRBRRBRRRBB
RRBRRRRBBBRRBBRRRBBRRRRRB
BBRBBRBBBRBRRBRRRBRRRRBRRRRRRBRRRRRRBRRRRBBBRBRBRR
BRRRBBBBRBRBBRRRBRRRRBRRRRRBRRRBRRBRRRBRRBRRRRBRRR
RRBRBRBRBBBBRBBRRRRBRRRBRRBRBRRBBRBBBRBBRRR
BRRBBRBBBBRBBRBBBBBRRBRBBRBBBRRBBRBBBR...

result:

ok ok (1000 test cases)

Test #39:

score: 0
Accepted
time: 462ms
memory: 3648kb

input:

1000
14 31
7 10
12 6
9 1
14 4
7 2
7 12
14 11
6 7
10 6
14 13
10 1
7 1
7 9
11 8
13 4
14 7
13 5
9 10
6 2
2 13
4 8
6 13
4 7
7 13
11 13
12 10
12 8
9 5
13 8
11 3
9 11
14 39
10 4
13 9
7 5
10 6
14 2
1 10
12 7
3 7
10 11
6 12
1 12
4 9
11 13
12 3
3 10
10 8
7 14
11 12
13 3
1 5
2 6
12 4
9 12
5 12
11 14
1 13
8 14...

output:

BRRRBBBRBBRRRRRBRRBBBBRBBRRRBBR
BRBBRBBRRBRRBBBBRBRRBBBBBBBRRRBBRRRBBRR
BRRRRRRBRBRBBBBBRRBBBR
BBBBRRBRBRBBBBRBBRRBBBBBBRBBRRBBRBBRRBBBBBRBRRRBBBBBBBBBRBRRBBBBBRBRRRRRBRBBB
BBBRRBBRRBRBRBRRBBBBBBBBRBRRRRRBRBBRRRRBBRBBBBRRRBBBBRRRBBRBB
BBBBBRRRBRBRBBBRRRRBBBRRBBBBRBBBBBBRRBRRBBRB
BRBRRRBRBBBRRBBBBRRB...

result:

ok ok (1000 test cases)

Test #40:

score: 0
Accepted
time: 596ms
memory: 3772kb

input:

1000
15 52
8 6
15 14
2 5
11 3
4 2
1 13
14 8
8 4
6 5
5 8
13 3
10 8
6 14
10 12
8 9
7 2
9 5
1 2
12 5
12 4
2 3
5 11
9 15
6 15
9 14
7 5
13 11
5 3
10 1
9 4
7 8
3 15
15 7
9 1
10 14
7 10
9 11
15 8
13 4
9 3
15 12
8 3
5 13
15 1
3 6
13 15
8 2
15 4
2 13
13 9
4 14
5 1
15 56
3 7
8 5
6 1
11 12
14 5
13 5
4 6
8 2
15...

output:

BBRBBRRRRRBBRRRRRRRRRBRBRRRRBRRBRRBRRRRBBBRBBBRBRRRR
RRBRRBRRBRBRRBRRRBRBRRBRRRBRBRBRBRBRBBRBBRBRBRRBBBRBBBBB
BRRBBBRRRBRRBBRBRBBRBBBBBBRBRBRBBRRRBBRRRBRRBBBRRBBRBRBBBRRBRRBBBBBBBRBBRBRBBBBRRBBRBBBRRRR
BBBBRBBBBRBRRRRRBRRR
RBRRBRBBRRRRRRRBRRRRBRRBBRRRBBRRRBBBBBRRBBRBRB
RBRBBRBRBRBBRRRBBBRBRBRBB
BBBB...

result:

ok ok (1000 test cases)

Test #41:

score: -100
Wrong Answer
time: 722ms
memory: 3636kb

input:

1000
15 14
8 14
7 2
5 2
3 12
11 9
14 2
11 2
5 13
15 6
1 11
9 4
5 10
11 15
14 12
15 37
5 13
9 5
7 11
5 10
13 10
10 8
8 5
8 9
5 3
1 6
4 3
10 11
11 1
13 3
1 3
12 7
10 2
1 12
7 3
8 13
14 5
13 11
8 3
15 4
2 13
15 14
1 14
13 14
3 15
7 8
4 9
12 6
2 9
2 6
6 9
5 7
2 7
15 31
15 5
2 5
5 3
6 14
4 9
7 3
10 9
8 4...

output:

IMPOSSIBLE
RRBRBBRBRRBBBBRBBRRRRBRBRRRRBRRBBBRRB
RRRBRRBRRRRRRRBRBRBRRRBRBRBRRRB
BRRRRRRBBBRRBBRBRBRRBBRBBBBBBB
BBRBBBRRRBBRRRB
RRBRRRBBRRRBBBRBRRBRBBRRRRRBBBBRBRBRRRRRRBRRRBBBRBRBBRRBBBBRBBBBRB
BRBBRRBBRRBBBBBRBRRBBRBRRBBBRBRRBBBRRRRRBRBBRBRRBRRBRBRBRBRRBRBBRRRRBBBRBRRRRRBBRRBRBBBBBBRRB
RRBRRRRBBRB...

result:

wrong answer jury has answer but participant doesn't (test case 356)