#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int, int>
using namespace std;
signed main() {
int n, m, p;
cin >> n >> m;
vector<vector<pii>> adj(n + 1, vector<pii>(0));
vector<pii> changes (0);
for (int i = 1; i <= m; i++) {
int u, v;
cin >> u >> v;
adj[u].pb({v, i});
adj[v].pb({u, i});
}
cin >> p;
for (int i = 0; i < p; i++) {
int l, r;
cin >> l >> r;
changes.pb({l, r});
}
char str[m];
for (int i = 0; i < m; i++) str[i] = 'c';
for (int i = 0; i < p; i++) {
int start = changes[i].fi;
int end = changes[i].se;
if (adj[start].size() == 1) { // R
int ind = adj[start][0].se - 1;
if (str[ind] == 'c') str[ind] = 'R';
else if (str[ind] == 'L') str[ind] = 'B';
}
if (adj[end].size() == 1) { // L
int ind = adj[end][0].se - 1;
if (str[ind] == 'c') str[ind] = 'L';
else if (str[ind] == 'R') str[ind] = 'B';
}
}
string res = "";
for (char c : str) {
if (c == 'c') res += 'B';
else res += c;
}
cout << res << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |