#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);cin.tie(0);
int N, M;
cin>>N>>M;
int E[M*2+2], F[M*2+2], G[N]{};
for(int i=1; i<=M; i++) {
int a, b;
cin>>a>>b; --a, --b;
E[i*2]=b, F[i*2]=G[a], G[a]=i*2;
E[i*2+1]=a, F[i*2+1]=G[b], G[b]=i*2+1;
}
int A[N]{}, T[N], t=0, v=N, st;
bool U[M+1]{}, V[M+1]{};
cin>>st>>st;
function<void(int, int)> bcc=[&](int i, int p) {
A[i]=T[i]=++t;
for(int e=G[i]; e; e=F[e]) if(e!=p) {
int&j=E[e];
if(A[j]) { T[i]=min(T[i], A[j]); continue; }
bcc(j, e^1);
T[i]=min(T[i], T[j]);
U[p>>1]^=U[e>>1]^=j==st;
U[e>>1]^=e&1;
if(A[i]<T[j]) V[e>>1]=true;
}
};
bcc(0, 0);
for(int i=1; i<=M; i++)
cout<<(V[i] ? U[i] ? 'R' : 'L' : 'B');
}
Compilation message
oneway.cpp: In function 'int main()':
oneway.cpp:15:25: warning: unused variable 'v' [-Wunused-variable]
15 | int A[N]{}, T[N], t=0, v=N, st;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |