Submission details
Task:Coloring
Sender:Casinosort
Submission time:2025-11-08 16:48:04 +0200
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.04 sdetails
#20.27 sdetails
#30.25 sdetails
#40.28 sdetails
#50.04 sdetails
#60.04 sdetails
#70.04 sdetails
#80.04 sdetails
#90.07 sdetails
#100.11 sdetails
#110.24 sdetails
#120.42 sdetails
#130.43 sdetails
#140.44 sdetails
#150.04 sdetails
#160.24 sdetails
#170.37 sdetails
#180.06 sdetails
#190.07 sdetails
#200.26 sdetails
#210.07 sdetails
#220.07 sdetails
#230.26 sdetails
#240.07 sdetails
#250.12 sdetails
#260.18 sdetails
#270.28 sdetails

Code

line = input().split()

n = int(line[0])
m = int(line[1])

edges = []
neighbors = [[] for _k in range(n)]
colors = [0 for _k in range(n)]

for _k in range(0, m):
    line = input().split()
    v1, v2 = int(line[0])-1, int(line[1])-1
    neighbors[v1].append(v2)
    neighbors[v2].append(v1) 

    """
    if neighbors[v1-1] == []:
        neighbors[v1-1] = [v2]
    else:
        neighbors[v1-1].append(v2)
    if neighbors[v2-1] == []:
        neighbors[v2-1] = [v1]
    else:
        neighbors[v2-1].append(v1)
    """
#node = 0
#colors[node] = 1
#print(neighbors)

for node in range(n):
    color_opts = [1,2,3,4,5,6]
    
    for neigh in neighbors[node]:
        cn = colors[neigh]
        if cn != 0 and (cn in color_opts):
            color_opts.remove(colors[neigh])
    
    colors[node] = min(color_opts)

print(colors)

Test details

Test 1

Verdict:

input
5 6
1 2
2 3
3 1
2 4
...

correct output
2 3 1 2 1

user output
[1, 2, 3, 1, 3]

Test 2

Verdict:

input
100000 199998
1 2
2 3
3 4
4 5
...

correct output
4 3 2 3 2 3 2 3 2 3 2 3 2 3 2 ...

user output
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2,...

Test 3

Verdict:

input
81251 200000
1 2
2 3
3 4
4 5
...

correct output
3 2 1 4 1 4 1 3 2 4 3 2 1 5 3 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 4

Verdict:

input
81251 200000
1 6251
6251 12501
12501 18751
18751 25001
...

correct output
3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 5

Verdict:

input
2 1
1 2

correct output
2 1

user output
[1, 2]

Test 6

Verdict:

input
5 7
3 1
3 4
2 4
2 5
...

correct output
1 3 3 2 1

user output
[1, 2, 2, 1, 3]

Test 7

Verdict:

input
9 10
4 6
5 8
9 6
5 4
...

correct output
3 2 1 1 3 2 1 1 1

user output
[1, 2, 2, 1, 3, 2, 2, 1, 1]

Test 8

Verdict:

input
65 100
34 52
42 65
48 6
62 63
...

correct output
2 2 3 2 1 1 4 1 5 3 3 4 3 1 1 ...

user output
[1, 1, 1, 2, 3, 1, 3, 2, 1, 1,...

Test 9

Verdict:

input
661 1000
102 270
29 1
235 291
1 28
...

correct output
2 1 1 1 2 1 1 2 1 2 2 2 3 2 3 ...

user output
[1, 1, 1, 2, 1, 2, 1, 1, 1, 2,...

Test 10

Verdict:

input
6658 10000
6255 6351
6240 811
5121 5120
562 563
...

correct output
3 3 1 1 2 2 1 2 3 1 3 3 2 1 2 ...

user output
[1, 1, 1, 1, 2, 1, 1, 1, 1, 1,...

Test 11

Verdict:

input
66713 100002
17616 53797
36477 36478
9289 9288
30331 12908
...

correct output
2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 ...

user output
[1, 1, 1, 1, 1, 1, 2, 1, 1, 1,...

Test 12

Verdict:

input
133153 199900
84918 102523
65880 121666
112752 112751
119806 92639
...

correct output
1 3 1 1 1 2 1 2 1 2 1 2 1 2 1 ...

user output
[1, 1, 1, 1, 1, 2, 1, 1, 2, 1,...

Test 13

Verdict:

input
132902 199904
38449 38448
103004 31700
24769 12112
102436 54041
...

correct output
1 1 2 1 1 3 1 2 1 1 1 1 1 1 1 ...

user output
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...

Test 14

Verdict:

input
133659 199900
106579 112407
107263 107093
11493 44214
15803 15804
...

correct output
2 2 1 1 1 2 1 1 1 1 2 1 1 2 3 ...

user output
[1, 1, 1, 1, 1, 2, 2, 1, 1, 1,...

Test 15

Verdict:

input
36 85
28 29
8 9
36 30
14 8
...

correct output
1 3 2 1 3 2 3 2 1 3 2 1 2 1 3 ...

user output
[1, 2, 1, 2, 1, 2, 2, 3, 4, 3,...

Test 16

Verdict:

input
40000 119201
16810 16610
34321 34120
38157 37956
24084 23883
...

correct output
3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 ...

user output
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2,...

Test 17

Verdict:

input
80000 199993
29955 9954
47408 27408
51231 51232
37204 37205
...

correct output
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

user output
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2,...

Test 18

Verdict:

input
15 35
3 2
3 4
4 2
5 4
...

correct output
2 1 3 2 4 5 2 3 4 3 2 4 3 2 1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 19

Verdict:

input
143 352
3 2
3 4
4 2
5 4
...

correct output
1 3 4 1 5 2 1 4 5 1 2 4 3 2 1 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 20

Verdict:

input
81256 198855
3 2
3 4
4 2
5 4
...

correct output
1 3 4 1 5 2 1 4 5 1 2 4 3 2 1 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 21

Verdict:

input
15 33
3 2
3 4
4 2
5 4
...

correct output
1 1 3 2 4 3 2 1 3 5 4 3 2 1 2

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 22

Verdict:

input
137 326
3 2
3 4
4 2
5 4
...

correct output
1 1 3 2 4 3 2 1 3 5 4 3 2 1 2 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 23

Verdict:

input
82312 198211
3 2
3 4
4 2
5 4
...

correct output
1 1 3 2 4 3 2 1 3 5 4 3 2 1 2 ...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 38, in <module>
    colors[node] = min(color_opts)
ValueError: arg is an empty sequence

Test 24

Verdict:

input
512 1025
2 13
13 3
2 14
14 3
...

correct output
2 1 2 5 1 3 4 2 1 2 1 4 3 3 3 ...

user output
[1, 2, 1, 3, 2, 4, 2, 1, 3, 1,...

Test 25

Verdict:

input
15342 30761
2 13
13 3
2 14
14 3
...

correct output
1 3 2 5 1 3 4 2 1 2 1 4 1 1 1 ...

user output
[1, 2, 1, 3, 2, 4, 2, 1, 3, 1,...

Test 26

Verdict:

input
51148 102547
2 13
13 3
2 14
14 3
...

correct output
1 3 2 5 1 3 4 2 1 2 1 4 1 1 1 ...

user output
[1, 2, 1, 3, 2, 4, 2, 1, 3, 1,...

Test 27

Verdict:

input
99735 199964
2 13
13 3
2 14
14 3
...

correct output
1 3 2 5 1 3 4 2 1 2 1 4 1 1 1 ...

user output
[1, 2, 1, 3, 2, 4, 2, 1, 3, 1,...