QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#309711#8128. Alternating Pathsucup-team266#WA 11ms3900kbC++142.7kb2024-01-20 20:11:152024-01-20 20:11:16

Judging History

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

  • [2024-01-20 20:11:16]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:3900kb
  • [2024-01-20 20:11:15]
  • 提交

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
*/
#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);
		}
	}
//	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;_<100;_++) 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: 1ms
memory: 3588kb

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:

RBBBBR
BRRBRR
IMPOSSIBLE

result:

ok ok (3 test cases)

Test #2:

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

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: 3848kb

input:

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

output:

RBRRBR

result:

ok ok (1 test case)

Test #4:

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

input:

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

output:

BRBRBRBB

result:

ok ok (1 test case)

Test #5:

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

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:

BRBRBRBRRRBB

result:

ok ok (1 test case)

Test #6:

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

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:

BBRRBRBRBRRRR

result:

ok ok (1 test case)

Test #7:

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

input:

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

output:

RRBBB

result:

ok ok (1 test case)

Test #8:

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

input:

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

output:

BRBRRRB

result:

ok ok (1 test case)

Test #9:

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

input:

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

output:

BRBRRRB

result:

ok ok (1 test case)

Test #10:

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

input:

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

output:

RBRBBR

result:

ok ok (1 test case)

Test #11:

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

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:

BBRBRRBRBR

result:

ok ok (1 test case)

Test #12:

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

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:

BBRRRRBRBRRRBR

result:

ok ok (1 test case)

Test #13:

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

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:

BRRRRRBRBRBB

result:

ok ok (1 test case)

Test #14:

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

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: 1ms
memory: 3888kb

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
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 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B
BR
BRR
BR
RB...

result:

ok ok (1000 test cases)

Test #17:

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

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
BR
BRB
RB
BRB
BR
BBB
RBB
BR
BBB
BR
BBR
RBB
RB
RB
RBB
RBR
BR
BRB
BRB
BBB
RB
RB
BR
RB
RB
BRR
RBB
RBB
RB
BR
BR
BR
RB
RBR
BR
RRB
BBB
RB
BBR
BR
RBB
RBB
BBR
BR
BBR
RB
BBB
RRB
BR
RB
RBB
RBR
RBR
BRR
RBR
BR
RRB
BRB
RB
RBB
RBB
BRB
RBB
BR
BR
BRB
RB
RBB
RRB
RB
BBB
RRB
BR
BR
BRB
BR
RBR
RRB
RBR
RBR
RRB
BR
...

result:

ok ok (1000 test cases)

Test #18:

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

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
3 4
3 2
3 1
2 1
4 2
4 6
4 1
2 4
2 1
1 3
3 2
3 4...

output:

RRBR
RBRB
BBBBR
IMPOSSIBLE
RBBBRR
IMPOSSIBLE
IMPOSSIBLE
RBBBB
BBRR
RBBBBB
BBRBRB
BRRBBR
RBBBRB
BRRB
RBB
BRRRBB
RRRB
RBBB
BRB
RBBBR
RBBRR
RRRB
RRRBRR
RRRBR
BBR
BBBBBR
BRBBRR
BRRRBB
BRRRRB
RRRBB
BBRBRR
BBRRR
RBB
IMPOSSIBLE
RRBR
BBRB
RBB
BBRB
BRRBBR
IMPOSSIBLE
RBB
BBBRB
IMPOSSIBLE
IMPOSSIBLE
BRRBBB
BBR...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
4 6
4 2
4 1
3 4
3 1
1 2
3 2
4 3
4 2
3 2
1 3
4 6
4 3
1 2
2 3
1 3
2 4
4 1
4 4
2 1
3 1
4 1
3 2
4 5
2 4
1 2
1 3
4 1
3 2
4 3
2 3
2 4
1 4
4 4
1 2
3 2
1 4
2 4
4 5
2 1
1 3
3 2
4 1
4 2
4 4
1 2
4 2
3 2
4 1
4 6
2 4
3 4
3 2
3 1
4 1
1 2
4 3
1 3
2 4
3 2
4 6
4 3
4 1
2 1
4 2
3 1
3 2
4 4
1 2
4 3
1 3
2 3
4 6
3 2...

output:

BBRBRR
BRB
RBBRRR
RRBB
BBBBR
BRB
BBBR
RBBRB
RBBB
RBBBRR
BBR
BRRBRR
RRRB
BRBRBB
RRRBB
IMPOSSIBLE
BBBRRR
RRRB
BRBRB
BBRBR
BRB
RBBBB
BRBBBB
BRRBB
RRBBBR
BBRBB
BBBRR
RRBB
RBBBBB
RBBB
BRBBBB
BRRB
RBRBRB
BRB
RBRRB
IMPOSSIBLE
RRRRB
RBBB
BRBBBR
BRBR
RBBR
RBRBRR
RBB
BBRRR
BRBRBB
BBR
IMPOSSIBLE
BBRB
BRB
BBBRR...

result:

ok ok (1000 test cases)

Test #20:

score: 0
Accepted
time: 5ms
memory: 3656kb

input:

1000
5 8
5 1
4 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BR
RBBBRBR
RBRBBBBBBR
BBBRRBRR
BBRRBBBRB
RBRBBR
BBBRBBRB
RBBRBB
BBRBR
IMPOSSIBLE
RRBB
BBRBBB
IMPOSSIBLE
IMPOSSIBLE
BRBR
BRRB
BRRBRRBBBB
RRBRB
IMPOSSIBLE
BBRBBB
BBBBBBBR
IMPOSSIBLE
RBBBR
RBBRRRRRBR
RBRRRBBR
RRBBRB
BRRRRBB...

result:

ok ok (1000 test cases)

Test #22:

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

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:

RBRRBRRBBR
RBBBRBRRBRB
IMPOSSIBLE
RBRRBR
BBRBBBBBR
BBRBBBRRRR
BBRBRRRBRRRRR
BBRBRBRRBBRBRB
RRRBRRBBBBR
RRBRBBRRR
RBBBRBRRBRBR
RRBBBBRRBRRR
RBBBRRBBRRRRBR
RBBRRBBRR
RRRRRRRBRRBB
BBRRRBBRRRBRBBR
RRBRRRRRBRBB
RRRBRBBRBR
RBBBBR
BBBBBRRBR
BBRRBBBRB
IMPOSSIBLE
BBBBBRBRRRBRR
IMPOSSIBLE
BRBBRRR
IMPOSSIBLE
I...

result:

ok ok (1000 test cases)

Test #23:

score: 0
Accepted
time: 7ms
memory: 3588kb

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 5
4 2
4 1
3 6
4 5
2 1
1 3
6 1
5 6
1 5
3 2
6 14
2 6
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R
RBRBBBBBBRBBRBRR
BRBRBRBBBRBBRBRRRRR
IMPOSSIBLE
RBBBRBBRR
IMPOSSIBLE
IMPOSSIBLE
BBRBBRBBRR
BBRRRRBBBBRBRR
BBBBRRR
RRBBRBBRRRBR...

result:

ok ok (1000 test cases)

Test #25:

score: 0
Accepted
time: 9ms
memory: 3544kb

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:

RBBRBBBBRRBRBRB
RRRBBRRBBRRRBBBBRR
BBBRBRRRRBBBRBB
BBBRBRBRBRBRBBRR
RBBRBBBBBRB
RBBRBBBBRBBBBRRBRBRR
RRBRBBRBRBBRBRBB
RRBRRBRBBRRRBBBRBRR
BBRRBBRRBBRRBRBB
IMPOSSIBLE
BBRRBBRR
BBBRRBRRRRBBRRBBRRB
RRRBRBRRRBBBBRBBBR
IMPOSSIBLE
BBBBRRBRBRB
BRBBRRRRRBR
RBRRRBBBRBRR
RBRRRRRBRBRRBBRRRRRRR
BBRBRBBRBBBRRB
B...

result:

ok ok (1000 test cases)

Test #26:

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

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 1
3 8
7 3
4 1
7 6
5 3
6 8
4 7
8 24
1 2
5 2
1 8
7 4
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BRRBRBBBBRRB
BBRBBRRBRR
BRBRBRRRRRRRBBR...

result:

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