QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#309835 | #8130. Yet Another Balanced Coloring Problem | ucup-team027# | WA | 1ms | 3504kb | C++23 | 616b | 2024-01-20 21:14:40 | 2024-01-20 21:14:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m; cin >> n >> m;
vector<vector<int>> g(n);
for (int i = 0; i < n-1; i++) {
int j; cin >> j; j--;
g[i].push_back(j);
g[j].push_back(i);
}
for (int i = 0; i < m-1; i++) {
int j; cin >> j;
}
int k = 0;
for (int i = 0; i < n-1; i++) {
if (g[i].size() == 1) k++;
else break;
}
for (int i = 0; i < k; i++) {
if (i % 2) cout << "B"; else cout << "R";
}
cout << '\n';
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int t; cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3504kb
input:
2 7 7 5 5 6 6 7 7 5 6 5 6 7 7 5 4 4 4 5 5 4 4 4
output:
RBRB RBR
result:
wrong answer charge of vertex 5 in tree 2 violates range (test case 1)