Task: | Graph painting |
Sender: | zah |
Submission time: | 2016-05-28 15:27:26 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | details |
#2 | WRONG ANSWER | 0.05 s | details |
#3 | WRONG ANSWER | 0.21 s | details |
Code
#include<iostream> #include <vector> using namespace std; int main(){ int t; cin >> t; for(int p=0; p<t; ++p){ int n, m; cin>> n >> m; vector<int> v[n+1]; for(int i=0; i<m; ++i){ int a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } char ss[n+1]; for( int i=0; i<=n; ++i) ss[i]='B'; int z[100001]={}; int e[100001]={}; vector<int> q; q.push_back(1); int y=0; char a[100001]; z[1]=1; e[1]=1; for(unsigned int i=0; i<q.size(); ++i){ for (unsigned int j=0; j<v[q[i]].size(); ++j){ int u=v[q[i]][j]; if (z[u]){ if (ss[u]==a[q[i]]){ ++y; } } else{ z[u]=1; if(e[q[i]]==1){ e[u]=2; ss[u]='R'; a[u]='B'; } else{ e[u]=2; a[u]='R'; } } } if(y>=m/2){ break; } } for (int i=1; i<=n; ++i){ cout << ss[i] << " "; } cout << "\n"; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 7 1 2 5 8 28 2 7 ... |
correct output |
---|
B R B B B B R R B B R B R B B R R B B B B R R R B B B R B R B B B B R B R R B R ... |
user output |
---|
B B B B B B B B R R R R R R R B R B R B B B B B B B R R R R R B R R R B B R B B ... |
Test 2
Verdict: WRONG ANSWER
input |
---|
10 38 36 18 28 20 37 22 38 ... |
correct output |
---|
R R B R B R R R R R B B R B R ... |
user output |
---|
B B B B B B B B B B B B B B B ... |
Test 3
Verdict: WRONG ANSWER
input |
---|
1 100000 200000 89300 98492 33853 56822 92967 99427 ... |
correct output |
---|
R R R R B R R R B B B R B B B ... |
user output |
---|
B B B B B B B B B B B B B B B ... |