Task: | Graph painting |
Sender: | Oispa Kaljaa |
Submission time: | 2016-05-28 12:15:18 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.07 s | details |
#2 | WRONG ANSWER | 0.06 s | details |
#3 | WRONG ANSWER | 0.12 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:26:6: warning: unused variable 'cur' [-Wunused-variable] int cur = vs[i].second; ^
Code
#include <bits/stdc++.h> using namespace std; int main(){ cin.sync_with_stdio(0); cin.tie(0); int tests; cin >> tests; while(tests--){ vector<int> v[101010]; int n, m; cin >> n >> m; bool ans[101010] = {0}; for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } vector<pair<int, int>> vs; for(int i = 1; i <= n; i++) vs.push_back({v[i].size(), i}); sort(vs.begin(), vs.end()); int cc = 0; for(int i = n-1; i >= 0; i--){ int cur = vs[i].second; ans[i] = 1; for(auto f: v[i]) if(ans[f] == 0) cc++; if(cc >= m/2) break; } for(int i = 1; i <= n; i++){ if(ans[i] == 1) cout << 'R' << " "; else cout << 'B' << " "; } cout << endl; } return 0; }
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 R B B B B B R R R B B B B B B B B R R B B B B R R B B B B B B B R R 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 ... |