Task: | Korn |
Sender: | Kuha |
Submission time: | 2016-08-04 16:11:17 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.06 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.06 s | details |
#7 | WRONG ANSWER | 0.06 s | details |
#8 | ACCEPTED | 0.06 s | details |
#9 | ACCEPTED | 0.06 s | details |
#10 | WRONG ANSWER | 0.05 s | details |
#11 | ACCEPTED | 0.06 s | details |
#12 | ACCEPTED | 0.06 s | details |
#13 | WRONG ANSWER | 0.05 s | details |
#14 | ACCEPTED | 0.06 s | details |
#15 | ACCEPTED | 0.06 s | details |
#16 | WRONG ANSWER | 0.06 s | details |
#17 | ACCEPTED | 0.06 s | details |
#18 | ACCEPTED | 0.07 s | details |
#19 | WRONG ANSWER | 0.19 s | details |
#20 | ACCEPTED | 0.15 s | details |
#21 | ACCEPTED | 0.20 s | details |
#22 | WRONG ANSWER | 0.34 s | details |
#23 | ACCEPTED | 0.27 s | details |
#24 | ACCEPTED | 0.41 s | details |
#25 | ACCEPTED | 0.32 s | details |
#26 | ACCEPTED | 0.30 s | details |
#27 | ACCEPTED | 0.29 s | details |
#28 | ACCEPTED | 0.26 s | details |
#29 | ACCEPTED | 0.23 s | details |
#30 | ACCEPTED | 0.24 s | details |
#31 | ACCEPTED | 0.23 s | details |
#32 | ACCEPTED | 0.24 s | details |
#33 | ACCEPTED | 0.29 s | details |
#34 | ACCEPTED | 0.29 s | details |
#35 | ACCEPTED | 0.38 s | details |
#36 | ACCEPTED | 0.47 s | details |
#37 | ACCEPTED | 0.46 s | details |
#38 | ACCEPTED | 0.42 s | details |
#39 | ACCEPTED | 0.44 s | details |
#40 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:63:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (v[i].size() == p->first) ans.push_back(i); ^ input/code.cpp:71:64: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i <= n; i++) if (v[i].size() == p->first) ei = i; ^ input/code.cpp:76:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (v[i].size() == t && !e[i]) { ^
Code
#include <bits/stdc++.h> #define uint unsigned int #define ull unsigned long long #define INF 999999999 #define LINF 999999999999999999 #define ll long long #define ld long double #define M 1000000007 #define E 0.0000001 #define N (1<<18) #define pii pair<int, int> #define pll pair<long long, long long> #define pdd pair<double, double> #define pld pair<long double, long double> #define cll complex<long long> #define cld complex<long double> #define X real() #define Y imag() #define C 'a' #define F first #define S second #define PI 3.1415926535897932384626433 using namespace std; vector<int> v[500001]; bool e[500001]; int ei; bool dfs (int i, bool f) { if (i == ei) return 1; if (e[i]) return 1; e[i] = true; if (v[i].size() > 2 && !f) return 0; for (int j : v[i]) if (!dfs(j, false)) return false; return true; } int main () { int n, m; cin>>n>>m; for (int i = 0; i < m; i++) { int a, b; cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } map<int, int> w; for (int i = 1; i <= n; i++) { if (v[i].size() % 2) { cout<<0<<endl; return 0; } w[v[i].size()]++; } if (w.size() > 1) { auto p = --(w.end()); if (w.size() == 2) { if (p->second < 3) { vector<int> ans; for (int i = 1; i <= n; i++) { if (v[i].size() == p->first) ans.push_back(i); } cout<<ans.size()<<endl; for (int i : ans) cout<<i<<" "; cout<<endl; } } else if (p->second > 1) cout<<0<<endl; else { for (int i = 1; i <= n; i++) if (v[i].size() == p->first) ei = i; --p; while (true) { int t = p->first; for (int i = 1; i <= n; i++) { if (v[i].size() == t && !e[i]) { if (!dfs(i, true)) cout<<0<<endl, exit(0); } } if (p == w.begin()) break; --p; } cout<<1<<endl<<ei<<endl; } } else if (w.size() == 1) { if (w.begin()->first == 2) { cout<<n<<endl; for (int i = 1; i <= n; i++) cout<<i<<" "; cout<<endl; } else cout<<0<<endl; } } /** 9 3 1 2 a 2 3 b 2 4 a 4 5 b 4 6 c 6 7 d 6 8 a 8 9 b acb 9 12 1 2 1 3 1 4 1 5 1 6 1 7 2 8 3 8 4 9 5 9 6 9 7 9 */
Test details
Test 1
Verdict: ACCEPTED
input |
---|
6 8 3 5 5 1 3 4 4 1 ... |
correct output |
---|
2 1 3 |
user output |
---|
2 1 3 |
Test 2
Verdict: ACCEPTED
input |
---|
3 3 1 2 2 3 3 1 |
correct output |
---|
3 1 2 3 |
user output |
---|
3 1 2 3 |
Test 3
Verdict: ACCEPTED
input |
---|
3 2 1 3 2 3 |
correct output |
---|
0 |
user output |
---|
0 |
Test 4
Verdict: ACCEPTED
input |
---|
5 7 1 3 4 2 1 2 1 4 ... |
correct output |
---|
2 1 2 |
user output |
---|
2 1 2 |
Test 5
Verdict: ACCEPTED
input |
---|
5 5 5 3 1 5 2 1 4 2 ... |
correct output |
---|
5 1 2 3 4 5 |
user output |
---|
5 1 2 3 4 5 |
Test 6
Verdict: ACCEPTED
input |
---|
5 6 4 1 5 3 1 5 4 3 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 7
Verdict: WRONG ANSWER
input |
---|
10 14 2 3 5 2 4 3 6 3 ... |
correct output |
---|
1 3 |
user output |
---|
0 |
Test 8
Verdict: ACCEPTED
input |
---|
10 10 4 5 2 9 8 1 7 10 ... |
correct output |
---|
10 1 2 3 4 5 6 7 8 9 10 |
user output |
---|
10 1 2 3 4 5 6 7 8 9 10 |
Test 9
Verdict: ACCEPTED
input |
---|
10 16 1 6 9 8 9 3 5 1 ... |
correct output |
---|
2 1 9 |
user output |
---|
2 1 9 |
Test 10
Verdict: WRONG ANSWER
input |
---|
100 168 53 8 35 44 98 64 28 85 ... |
correct output |
---|
1 62 |
user output |
---|
0 |
Test 11
Verdict: ACCEPTED
input |
---|
100 100 53 69 80 33 31 19 61 45 ... |
correct output |
---|
100 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
100 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 12
Verdict: ACCEPTED
input |
---|
100 196 44 85 68 86 86 55 44 56 ... |
correct output |
---|
2 44 86 |
user output |
---|
2 44 86 |
Test 13
Verdict: WRONG ANSWER
input |
---|
1000 1636 85 954 434 807 657 942 363 998 ... |
correct output |
---|
1 942 |
user output |
---|
0 |
Test 14
Verdict: ACCEPTED
input |
---|
1000 1000 154 824 455 878 521 429 806 795 ... |
correct output |
---|
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 15
Verdict: ACCEPTED
input |
---|
1000 1996 346 472 472 632 472 737 666 742 ... |
correct output |
---|
2 472 666 |
user output |
---|
2 472 666 |
Test 16
Verdict: WRONG ANSWER
input |
---|
10000 16544 8723 5854 6694 5854 5813 9842 7775 450 ... |
correct output |
---|
1 5854 |
user output |
---|
0 |
Test 17
Verdict: ACCEPTED
input |
---|
10000 10000 6328 1933 3215 2119 133 597 5752 355 ... |
correct output |
---|
10000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
10000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 18
Verdict: ACCEPTED
input |
---|
10000 19996 3251 3276 7746 2914 7968 3276 4133 3276 ... |
correct output |
---|
2 3276 7746 |
user output |
---|
2 3276 7746 |
Test 19
Verdict: WRONG ANSWER
input |
---|
100000 166466 48709 66850 19284 9360 70023 41035 10202 54726 ... |
correct output |
---|
1 26348 |
user output |
---|
0 |
Test 20
Verdict: ACCEPTED
input |
---|
100000 100000 13837 61303 89733 92564 27261 66328 53389 4963 ... |
correct output |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 21
Verdict: ACCEPTED
input |
---|
100000 199996 7841 69346 92805 7841 2391 7841 35715 86148 ... |
correct output |
---|
2 7841 86148 |
user output |
---|
2 7841 86148 |
Test 22
Verdict: WRONG ANSWER
input |
---|
200000 333292 177495 59529 65976 27906 183521 63384 130253 63384 ... |
correct output |
---|
1 63384 |
user output |
---|
0 |
Test 23
Verdict: ACCEPTED
input |
---|
200000 200000 172688 83121 94308 125397 121698 111684 122896 139134 ... |
correct output |
---|
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 24
Verdict: ACCEPTED
input |
---|
200000 399996 195502 195302 97487 195502 31836 180762 31836 114578 ... |
correct output |
---|
2 31836 195502 |
user output |
---|
2 31836 195502 |
Test 25
Verdict: ACCEPTED
input |
---|
199999 299997 133842 56831 161198 197552 52013 56831 113824 141089 ... |
correct output |
---|
1 56831 |
user output |
---|
1 56831 |
Test 26
Verdict: ACCEPTED
input |
---|
199966 266620 30805 74947 131498 74947 148055 45573 176247 144198 ... |
correct output |
---|
1 74947 |
user output |
---|
1 74947 |
Test 27
Verdict: ACCEPTED
input |
---|
199996 239994 194088 176928 84078 66003 155399 181267 109363 24037 ... |
correct output |
---|
1 109562 |
user output |
---|
1 109562 |
Test 28
Verdict: ACCEPTED
input |
---|
199991 219989 26995 182816 44231 104797 66799 189612 60325 120474 ... |
correct output |
---|
1 104797 |
user output |
---|
1 104797 |
Test 29
Verdict: ACCEPTED
input |
---|
199901 201899 183049 162042 30129 98024 109542 162807 165887 186046 ... |
correct output |
---|
1 174098 |
user output |
---|
1 174098 |
Test 30
Verdict: ACCEPTED
input |
---|
199001 199199 190576 15936 195289 88100 62330 151921 85433 28871 ... |
correct output |
---|
1 193563 |
user output |
---|
1 193563 |
Test 31
Verdict: ACCEPTED
input |
---|
190001 190019 146460 136366 152584 71295 18424 74288 160666 4293 ... |
correct output |
---|
1 27520 |
user output |
---|
1 27520 |
Test 32
Verdict: ACCEPTED
input |
---|
199999 200000 83463 54906 14939 155153 76174 149737 103606 118771 ... |
correct output |
---|
1 72170 |
user output |
---|
1 72170 |
Test 33
Verdict: ACCEPTED
input |
---|
199999 250000 123656 75970 102071 118565 107227 44491 45664 44905 ... |
correct output |
---|
1 123656 |
user output |
---|
1 123656 |
Test 34
Verdict: ACCEPTED
input |
---|
198999 232000 42059 44655 32973 54440 47844 127864 146216 69825 ... |
correct output |
---|
1 54440 |
user output |
---|
1 54440 |
Test 35
Verdict: ACCEPTED
input |
---|
200000 343236 6172 121380 73997 136680 36608 38156 197529 31059 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 36
Verdict: ACCEPTED
input |
---|
200000 449162 22188 74069 131951 149472 119926 72522 95032 63026 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 37
Verdict: ACCEPTED
input |
---|
200000 449162 55595 43502 66495 49607 133565 22459 94162 167595 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 38
Verdict: ACCEPTED
input |
---|
100000 425091 50386 81052 89464 80178 93037 61330 22465 60956 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 39
Verdict: ACCEPTED
input |
---|
100000 474998 59563 73951 69846 82117 79750 49503 65426 15307 ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 40
Verdict: ACCEPTED
input |
---|
3 2 1 2 3 1 |
correct output |
---|
0 |
user output |
---|
0 |