Submission details
Task:VERTEX COVER
Sender:PyPy > Assembly
Submission time:2016-10-04 18:59:05 +0300
Language:Python3
Status:READY
Result:
Test results
testverdicttime
#10.16 sdetails
#20.11 sdetails
#30.10 sdetails
#40.22 sdetails
#50.21 sdetails
#60.23 sdetails
#70.23 sdetails
#80.12 sdetails
#90.15 sdetails
#100.31 sdetails
#110.21 sdetails
#120.29 sdetails
#130.29 sdetails
#140.27 sdetails
#150.27 sdetails
#160.33 sdetails
#170.27 sdetails
#180.27 sdetails
#190.27 sdetails
#200.30 sdetails
#210.28 sdetails
#220.26 sdetails
#230.34 sdetails
#240.28 sdetails
#250.27 sdetails
#260.28 sdetails
#270.31 sdetails
#280.28 sdetails
#290.38 sdetails
#300.27 sdetails

Code

from sys import stdin

n = int(stdin.readline())

v = {}
extras = []
root = None

for _ in range(n+1):
    a, b = tuple(map(int, stdin.readline().split()))

    if a not in v:
        v[a] = [b]
        if root is None:
            root = a
        elif b == root:
            root = a
    elif b not in v:
        v[a].append(b)
    else:
        extras.append((a, b))

out = 0

selected = []

for k in v:
    for fuck in v[k]:
        if fuck in v and v[fuck] not in v:
            out += 1
            selected.append(k)

fix = True
i = 0

from itertools import chain

for a, b in extras:
    i += 1
    if a in selected and b in selected:
        other = (i-1) ^ 1
        ankka, duck = extras[other]
        if ankka not in v or duck not in v or v[ankka] not in v or v[duck] not in v:
            out -= 1
    if a in selected or b in selected:
        fix = False
        continue
    out += 1

if fix and len(set(chain.from_iterable(extras))) < 4:
    out -= 1

print(out)

Test details

Test 1

Verdict:

input
43516
31635 7283
407 22068
14527 27341
13988 3756
...

correct output
15856

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 2

Verdict:

input
15844
11075 5963
12852 1355
12408 997
5774 1839
...

correct output
6691

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 3

Verdict:

input
16739
5194 10683
1122 249
3384 12552
9483 5513
...

correct output
6757

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 4

Verdict:

input
45585
2278 17306
29200 4367
3493 946
13733 29961
...

correct output
16583

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 5

Verdict:

input
65713
48285 11821
34133 22499
14959 39378
27756 2333
...

correct output
27673

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 6

Verdict:

input
65594
48205 44126
49025 17567
49495 29064
5497 9432
...

correct output
26501

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 7

Verdict:

input
76352
41529 44956
24215 33162
32459 57488
36012 8978
...

correct output
27769

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 8

Verdict:

input
19735
3280 11743
5800 4932
15996 16996
1326 8492
...

correct output
8362

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 9

Verdict:

input
49843
38377 42277
22655 27295
9233 8151
20174 26700
...

correct output
20103

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 10

Verdict:

input
93738
34468 1473
62502 21129
7249 69111
34431 14831
...

correct output
34129

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 11

Verdict:

input
70512
59016 43446
23523 34215
40100 65349
32479 69170
...

correct output
29712

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 12

Verdict:

input
77793
67362 43115
26066 53059
34877 28252
41322 27232
...

correct output
31415

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 13

Verdict:

input
81528
17424 60496
16303 9750
72040 16424
73313 66255
...

correct output
29740

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 14

Verdict:

input
87601
26609 79183
12401 22737
40749 41820
44416 43745
...

correct output
36915

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 15

Verdict:

input
100000
99312 64091
74701 14263
18494 14204
48860 56668
...

correct output
40376

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 16

Verdict:

input
100000
85199 85147
16157 86513
31941 9017
28468 14549
...

correct output
50000

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 17

Verdict:

input
100000
23889 65680
23889 43172
31662 23889
23889 14952
...

correct output
3

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 18

Verdict:

input
100000
69560 99883
72675 99883
46326 77576
99883 92496
...

correct output
6

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 19

Verdict:

input
100000
28151 97740
74287 42190
55692 76617
51247 37435
...

correct output
36374

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 20

Verdict:

input
100000
92176 53508
59512 60686
3760 73799
25954 68463
...

correct output
42107

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 21

Verdict:

input
100000
77208 54647
86577 72654
30560 44935
58433 65087
...

correct output
40367

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 22

Verdict:

input
100000
11835 72732
46693 14441
91141 81072
9142 96454
...

correct output
36396

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 23

Verdict:

input
100000
62977 19876
33643 71597
43079 56905
55474 63340
...

correct output
42014

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 24

Verdict:

input
100000
10558 826
71579 31910
52499 85798
49687 29460
...

correct output
40315

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 25

Verdict:

input
100000
42867 7204
6642 28627
52963 75885
5909 2124
...

correct output
36378

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 26

Verdict:

input
100000
98353 70486
18269 81832
96346 42985
52089 65027
...

correct output
42053

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 27

Verdict:

input
100000
95632 70669
80227 14695
8281 32693
36226 99062
...

correct output
40405

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 28

Verdict:

input
100000
93396 66096
17209 78703
63472 8252
44686 81626
...

correct output
36410

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 29

Verdict:

input
100000
76692 65797
61491 11409
1719 12971
71081 59660
...

correct output
42226

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'

Test 30

Verdict:

input
100000
41478 47936
87485 27259
90595 12109
53850 41021
...

correct output
40385

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 29, in <module>
    if fuck in v and v[fuck] not in v:
TypeError: unhashable type: 'list'