Task: | Coloring |
Sender: | team univelka |
Submission time: | 2017-10-03 18:19:07 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.04 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | ACCEPTED | 0.06 s | details |
#7 | ACCEPTED | 0.04 s | details |
#8 | WRONG ANSWER | 0.05 s | details |
#9 | ACCEPTED | 0.05 s | details |
#10 | ACCEPTED | 0.05 s | details |
#11 | WRONG ANSWER | 0.07 s | details |
#12 | WRONG ANSWER | 0.05 s | details |
#13 | WRONG ANSWER | 0.10 s | details |
#14 | WRONG ANSWER | 0.09 s | details |
#15 | WRONG ANSWER | 0.10 s | details |
#16 | WRONG ANSWER | 0.07 s | details |
#17 | WRONG ANSWER | 0.18 s | details |
#18 | WRONG ANSWER | 0.19 s | details |
#19 | WRONG ANSWER | 0.09 s | details |
#20 | WRONG ANSWER | 0.06 s | details |
#21 | WRONG ANSWER | 0.16 s | details |
#22 | WRONG ANSWER | 0.06 s | details |
#23 | WRONG ANSWER | 0.07 s | details |
#24 | WRONG ANSWER | 0.20 s | details |
#25 | WRONG ANSWER | 0.20 s | details |
#26 | WRONG ANSWER | 0.06 s | details |
#27 | WRONG ANSWER | 0.11 s | details |
#28 | WRONG ANSWER | 0.14 s | details |
#29 | WRONG ANSWER | 0.16 s | details |
#30 | WRONG ANSWER | 0.14 s | details |
#31 | WRONG ANSWER | 0.06 s | details |
#32 | WRONG ANSWER | 0.06 s | details |
#33 | WRONG ANSWER | 0.18 s | details |
#34 | WRONG ANSWER | 0.11 s | details |
#35 | WRONG ANSWER | 0.06 s | details |
#36 | WRONG ANSWER | 0.09 s | details |
#37 | WRONG ANSWER | 0.07 s | details |
#38 | ACCEPTED | 0.09 s | details |
#39 | WRONG ANSWER | 0.12 s | details |
#40 | WRONG ANSWER | 0.07 s | details |
#41 | WRONG ANSWER | 0.06 s | details |
#42 | WRONG ANSWER | 0.11 s | details |
#43 | WRONG ANSWER | 0.12 s | details |
#44 | WRONG ANSWER | 0.09 s | details |
#45 | WRONG ANSWER | 0.13 s | details |
#46 | WRONG ANSWER | 0.15 s | details |
#47 | WRONG ANSWER | 0.10 s | details |
#48 | ACCEPTED | 0.15 s | details |
#49 | WRONG ANSWER | 0.09 s | details |
#50 | WRONG ANSWER | 0.09 s | details |
Compiler report
input/code.cpp: In function 'void color_vertex(int)': input/code.cpp:12:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int j = 0; j < graph[i].size(); ++j) { ^ input/code.cpp:22:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int j = 0; j < graph[i].size(); ++j) { ^ input/code.cpp:25:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int j = 0; j < graph[i].size(); ++j) { ^
Code
#include <iostream> #include <vector> const int N = 5 * (1e5); int color [N+1]; bool legal [N+1]; std::vector<int> graph [N]; int max = 0; void color_vertex(int i) { if (color[i]) return; for (int j = 0; j < graph[i].size(); ++j) { legal[color[graph[i][j]]] = false; } for (int j = 1;; ++j) { if (legal[j]) { color[i] = j; if (j > max) max = j; break; } } for (int j = 0; j < graph[i].size(); ++j) { legal[color[graph[i][j]]] = true; } for (int j = 0; j < graph[i].size(); ++j) { color_vertex(graph[i][j]); } } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int n, m; std::cin >> n >> m; for (int i = 1; i <= n; ++i) legal[i] = true; for (int i = 0; i < m; ++i) { int a, b; std::cin >> a >> b; --a; --b; graph[a].push_back(b); graph[b].push_back(a); } color_vertex(0); std::cout << max << '\n'; for (int i = 0; i < n; ++i) { std::cout << color[i] << ' '; } std::cout << '\n'; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 1 1 2 |
correct output |
---|
2 1 2 |
user output |
---|
2 1 2 |
Test 2
Verdict: ACCEPTED
input |
---|
4 5 4 2 4 1 4 3 2 1 ... |
correct output |
---|
3 3 2 3 1 |
user output |
---|
3 1 3 1 2 |
Test 3
Verdict: ACCEPTED
input |
---|
2 1 2 1 |
correct output |
---|
2 2 1 |
user output |
---|
2 1 2 |
Test 4
Verdict: WRONG ANSWER
input |
---|
4 2 4 1 4 2 |
correct output |
---|
2 2 2 1 1 |
user output |
---|
2 1 1 0 2 |
Test 5
Verdict: ACCEPTED
input |
---|
3 3 2 3 2 1 3 1 |
correct output |
---|
3 3 1 2 |
user output |
---|
3 1 2 3 |
Test 6
Verdict: ACCEPTED
input |
---|
3 3 2 3 2 1 3 1 |
correct output |
---|
3 3 1 2 |
user output |
---|
3 1 2 3 |
Test 7
Verdict: ACCEPTED
input |
---|
2 1 1 2 |
correct output |
---|
2 1 2 |
user output |
---|
2 1 2 |
Test 8
Verdict: WRONG ANSWER
input |
---|
6 3 3 2 4 5 1 6 |
correct output |
---|
2 1 2 1 1 2 2 |
user output |
---|
2 1 0 0 0 0 2 |
Test 9
Verdict: ACCEPTED
input |
---|
3 3 1 3 1 2 3 2 |
correct output |
---|
3 1 3 2 |
user output |
---|
3 1 3 2 |
Test 10
Verdict: ACCEPTED
input |
---|
3 2 1 3 1 2 |
correct output |
---|
2 1 2 2 |
user output |
---|
2 1 2 2 |
Test 11
Verdict: WRONG ANSWER
input |
---|
13794 77893 6985 6447 6985 3470 6985 3433 6985 4156 ... |
correct output |
---|
7 5 7 6 6 4 6 2 6 1 7 3 4 1 4 1 ... |
user output |
---|
7 1 7 6 6 4 6 3 6 0 7 0 4 0 4 2 ... |
Test 12
Verdict: WRONG ANSWER
input |
---|
3786 17640 3578 1610 1445 849 1445 2713 1445 1015 ... |
correct output |
---|
6 6 6 1 1 5 5 5 1 5 5 6 2 3 2 1 ... |
user output |
---|
7 1 5 1 5 6 6 4 4 4 6 6 5 3 2 5 ... |
Test 13
Verdict: WRONG ANSWER
input |
---|
55109 183490 42108 14205 42108 11306 42108 7732 42108 31683 ... |
correct output |
---|
5 2 1 4 1 2 2 3 4 1 5 3 1 2 1 4 ... |
user output |
---|
5 1 0 0 0 0 0 3 0 0 0 0 2 0 0 0 ... |
Test 14
Verdict: WRONG ANSWER
input |
---|
30960 72203 9023 19362 9023 30311 9023 19946 9023 4668 ... |
correct output |
---|
4 2 2 4 1 1 1 2 1 3 1 3 2 2 3 1 ... |
user output |
---|
4 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ... |
Test 15
Verdict: WRONG ANSWER
input |
---|
40473 202109 28082 11520 28082 27997 28082 32841 28082 30658 ... |
correct output |
---|
7 3 3 2 2 1 4 6 3 1 4 2 7 5 5 6 ... |
user output |
---|
7 1 0 0 0 0 0 0 3 1 4 3 0 0 0 0 ... |
Test 16
Verdict: WRONG ANSWER
input |
---|
22645 90849 4340 19302 4340 18273 19302 18273 6145 10724 ... |
correct output |
---|
7 2 5 1 4 4 2 6 6 6 7 3 4 5 6 5 ... |
user output |
---|
7 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 17
Verdict: WRONG ANSWER
input |
---|
104458 347274 74164 56731 74164 103687 74164 531 74164 11407 ... |
correct output |
---|
5 5 4 5 5 3 1 2 5 1 4 2 3 5 2 2 ... |
user output |
---|
5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 18
Verdict: WRONG ANSWER
input |
---|
82811 412177 41794 7339 41794 35461 41794 55928 41794 74009 ... |
correct output |
---|
6 4 2 5 4 3 1 3 6 3 6 1 1 4 5 6 ... |
user output |
---|
6 1 1 5 4 3 0 3 0 3 6 2 2 3 0 0 ... |
Test 19
Verdict: WRONG ANSWER
input |
---|
22073 80302 562 11587 562 12309 562 6180 562 16773 ... |
correct output |
---|
5 3 1 1 3 2 5 2 3 2 2 4 1 1 4 1 ... |
user output |
---|
5 1 0 0 3 0 0 1 0 2 0 4 0 2 0 2 ... |
Test 20
Verdict: WRONG ANSWER
input |
---|
20151 53676 19899 6564 19899 10875 19899 12343 19899 19343 ... |
correct output |
---|
4 1 3 3 2 2 1 1 4 4 1 3 4 2 4 2 ... |
user output |
---|
5 1 0 0 0 0 0 2 1 0 1 4 0 0 0 3 ... |
Test 21
Verdict: WRONG ANSWER
input |
---|
87689 349330 52362 42317 52362 56383 52362 24481 52362 11351 ... |
correct output |
---|
5 3 5 4 1 1 5 3 5 1 2 3 2 1 4 1 ... |
user output |
---|
5 1 0 0 0 0 5 0 0 0 0 0 0 0 0 0 ... |
Test 22
Verdict: WRONG ANSWER
input |
---|
20973 55737 14365 12374 14365 20735 14365 16083 14365 7543 ... |
correct output |
---|
4 4 4 3 4 4 4 2 4 1 3 1 1 3 4 3 ... |
user output |
---|
4 1 4 3 4 4 4 2 4 1 3 1 1 3 4 0 ... |
Test 23
Verdict: WRONG ANSWER
input |
---|
14512 82082 11536 6691 11536 8693 11536 1120 11536 3076 ... |
correct output |
---|
7 1 3 4 1 5 1 4 6 7 7 2 3 7 4 2 ... |
user output |
---|
7 1 4 4 1 5 1 2 6 7 7 0 4 0 2 3 ... |
Test 24
Verdict: WRONG ANSWER
input |
---|
199586 399178 181845 140022 181845 111958 181845 101387 181845 133515 ... |
correct output |
---|
4 2 1 1 3 3 2 2 4 3 3 3 3 4 4 2 ... |
user output |
---|
4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 25
Verdict: WRONG ANSWER
input |
---|
177400 354950 39563 159240 39563 85409 39563 140869 39563 141648 ... |
correct output |
---|
4 1 1 1 3 4 2 2 2 2 1 1 2 4 3 4 ... |
user output |
---|
4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 26
Verdict: WRONG ANSWER
input |
---|
4612 22242 4276 3280 4276 4309 4276 1680 4276 2574 ... |
correct output |
---|
6 6 3 5 2 6 3 3 6 2 3 1 2 2 2 3 ... |
user output |
---|
6 1 1 0 1 6 0 0 6 0 4 0 1 3 1 0 ... |
Test 27
Verdict: WRONG ANSWER
input |
---|
47422 173573 28259 36080 28259 30483 28259 22898 28259 7661 ... |
correct output |
---|
6 4 5 6 2 6 3 1 6 4 2 6 2 1 3 4 ... |
user output |
---|
7 1 5 6 2 6 3 1 6 4 2 6 2 1 3 4 ... |
Test 28
Verdict: WRONG ANSWER
input |
---|
69212 276179 5283 26592 5283 44635 5283 51917 5283 69140 ... |
correct output |
---|
7 7 1 7 2 1 4 5 7 2 1 4 1 1 3 7 ... |
user output |
---|
7 1 0 7 2 0 0 0 7 0 0 0 0 0 0 0 ... |
Test 29
Verdict: WRONG ANSWER
input |
---|
80389 240682 53944 44594 53944 14653 53944 31020 53944 43096 ... |
correct output |
---|
4 4 4 2 3 3 2 1 2 3 3 3 2 4 3 3 ... |
user output |
---|
4 1 0 3 0 0 0 0 0 0 3 3 1 1 3 4 ... |
Test 30
Verdict: WRONG ANSWER
input |
---|
56041 280185 44140 5624 44140 17649 44140 31376 44140 8175 ... |
correct output |
---|
6 3 6 3 2 2 1 3 5 2 3 4 3 6 3 5 ... |
user output |
---|
7 1 6 3 6 1 2 3 5 6 3 4 3 5 3 5 ... |
Test 31
Verdict: WRONG ANSWER
input |
---|
563 77028 348 227 348 373 348 518 348 282 ... |
correct output |
---|
193 59 8 88 63 63 155 106 91 181 1... |
user output |
---|
193 1 8 88 63 63 155 106 91 181 16... |
Test 32
Verdict: WRONG ANSWER
input |
---|
2836 81623 2230 1248 1248 770 1248 2421 1248 2559 ... |
correct output |
---|
34 21 31 22 20 13 15 29 7 21 11 2... |
user output |
---|
34 1 31 22 21 13 13 29 5 21 10 29... |
Test 33
Verdict: WRONG ANSWER
input |
---|
8845 476380 1312 1029 1312 228 1312 7927 1312 6998 ... |
correct output |
---|
77 70 21 17 34 70 41 25 71 75 51 ... |
user output |
---|
77 1 21 18 34 70 41 25 71 75 51 3... |
Test 34
Verdict: WRONG ANSWER
input |
---|
5282 269720 3357 4982 3357 1575 3357 2987 3357 1839 ... |
correct output |
---|
91 8 8 28 84 33 2 47 39 57 37 38 ... |
user output |
---|
91 1 8 28 0 0 0 0 39 0 37 0 0 0 3... |
Test 35
Verdict: WRONG ANSWER
input |
---|
357 30411 162 246 246 46 246 75 246 48 ... |
correct output |
---|
101 76 79 67 68 18 7 79 83 27 73 1... |
user output |
---|
101 1 79 68 69 18 8 79 83 27 74 18... |
Test 36
Verdict: WRONG ANSWER
input |
---|
1899 140514 1618 177 1618 1196 1618 1788 1618 1577 ... |
correct output |
---|
153 13 113 148 25 13 72 134 14 100... |
user output |
---|
153 1 113 0 0 0 0 0 0 0 5 132 20 0... |
Test 37
Verdict: WRONG ANSWER
input |
---|
3204 108014 118 2289 118 2744 118 2511 118 549 ... |
correct output |
---|
65 54 47 36 14 8 51 63 14 34 50 3... |
user output |
---|
65 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 38
Verdict: ACCEPTED
input |
---|
5821 241726 3793 2038 3793 4690 2038 4690 2038 3784 ... |
correct output |
---|
62 26 18 53 3 38 59 50 14 42 1 32... |
user output |
---|
62 1 18 53 3 38 59 50 14 42 1 32 ... |
Test 39
Verdict: WRONG ANSWER
input |
---|
4678 436484 2218 2359 2218 1050 2218 1624 2218 3294 ... |
correct output |
---|
189 70 168 160 159 49 98 147 46 17... |
user output |
---|
189 1 0 0 0 0 0 0 46 0 0 0 0 0 27 ... |
Test 40
Verdict: WRONG ANSWER
input |
---|
3302 144229 3001 220 3001 2674 3001 39 3001 3250 ... |
correct output |
---|
85 77 81 14 66 31 82 51 84 47 78 ... |
user output |
---|
85 1 0 14 67 0 0 0 84 0 0 0 25 0 ... |
Test 41
Verdict: WRONG ANSWER
input |
---|
109 2800 28 13 48 41 48 35 48 5 ... |
correct output |
---|
55 12 19 54 29 4 41 5 7 10 21 20 ... |
user output |
---|
55 1 19 54 29 4 41 5 9 10 21 20 1... |
Test 42
Verdict: WRONG ANSWER
input |
---|
4215 363700 2937 2900 2455 3174 2455 2633 2455 473 ... |
correct output |
---|
98 77 35 72 27 66 96 29 87 60 95 ... |
user output |
---|
98 1 35 72 29 66 96 31 87 60 95 8... |
Test 43
Verdict: WRONG ANSWER
input |
---|
6155 290517 3343 4997 3343 3824 3343 4737 3343 2496 ... |
correct output |
---|
93 37 41 58 43 10 23 31 48 90 78 ... |
user output |
---|
93 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 44
Verdict: WRONG ANSWER
input |
---|
3799 90298 616 698 616 405 616 1711 616 2390 ... |
correct output |
---|
30 16 4 10 25 9 20 1 19 11 24 21 ... |
user output |
---|
30 1 4 0 0 0 0 0 0 11 24 21 26 0 ... |
Test 45
Verdict: WRONG ANSWER
input |
---|
11286 357366 3663 6134 3663 9835 3663 9432 3663 2913 ... |
correct output |
---|
50 32 5 48 27 9 24 50 36 44 29 37... |
user output |
---|
50 1 0 0 27 9 0 50 0 44 0 0 0 31 ... |
Test 46
Verdict: WRONG ANSWER
input |
---|
8621 482274 6328 485 6328 5699 6328 8256 6328 7193 ... |
correct output |
---|
93 68 5 17 23 9 68 63 71 80 59 9 ... |
user output |
---|
93 1 5 17 23 9 68 63 0 80 0 9 10 ... |
Test 47
Verdict: WRONG ANSWER
input |
---|
4442 170116 4300 2939 4300 2772 4300 3349 4300 1116 ... |
correct output |
---|
65 18 40 6 17 51 60 24 21 11 62 2... |
user output |
---|
65 1 40 0 0 0 0 0 21 11 0 24 6 0 ... |
Test 48
Verdict: ACCEPTED
input |
---|
5273 465102 2688 1460 2688 533 2688 812 2688 3196 ... |
correct output |
---|
108 42 18 15 26 42 70 37 77 63 101... |
user output |
---|
108 1 19 15 26 42 70 37 73 63 101 ... |
Test 49
Verdict: WRONG ANSWER
input |
---|
7184 246521 5000 1440 1960 5003 1960 5859 1960 1886 ... |
correct output |
---|
47 19 1 28 20 42 13 11 38 5 37 8 ... |
user output |
---|
47 1 1 28 20 42 11 11 38 5 37 9 3... |
Test 50
Verdict: WRONG ANSWER
input |
---|
2320 159706 101 1042 101 1270 101 95 101 939 ... |
correct output |
---|
98 24 4 20 67 30 35 94 95 9 76 51... |
user output |
---|
98 1 4 21 67 30 35 94 95 10 76 53... |