| Task: | Coloring |
| Sender: | Casinosort |
| Submission time: | 2025-11-08 16:53:16 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.04 s | details |
| #2 | WRONG ANSWER | 0.29 s | details |
| #3 | TIME LIMIT EXCEEDED | -- | details |
| #4 | TIME LIMIT EXCEEDED | -- | details |
| #5 | WRONG ANSWER | 0.04 s | details |
| #6 | WRONG ANSWER | 0.04 s | details |
| #7 | TIME LIMIT EXCEEDED | -- | details |
| #8 | TIME LIMIT EXCEEDED | -- | details |
| #9 | TIME LIMIT EXCEEDED | -- | details |
| #10 | TIME LIMIT EXCEEDED | -- | details |
| #11 | TIME LIMIT EXCEEDED | -- | details |
| #12 | TIME LIMIT EXCEEDED | -- | details |
| #13 | TIME LIMIT EXCEEDED | -- | details |
| #14 | TIME LIMIT EXCEEDED | -- | details |
| #15 | TIME LIMIT EXCEEDED | -- | details |
| #16 | TIME LIMIT EXCEEDED | -- | details |
| #17 | TIME LIMIT EXCEEDED | -- | details |
| #18 | TIME LIMIT EXCEEDED | -- | details |
| #19 | TIME LIMIT EXCEEDED | -- | details |
| #20 | TIME LIMIT EXCEEDED | -- | details |
| #21 | TIME LIMIT EXCEEDED | -- | details |
| #22 | TIME LIMIT EXCEEDED | -- | details |
| #23 | TIME LIMIT EXCEEDED | -- | details |
| #24 | TIME LIMIT EXCEEDED | -- | details |
| #25 | TIME LIMIT EXCEEDED | -- | details |
| #26 | TIME LIMIT EXCEEDED | -- | details |
| #27 | TIME LIMIT EXCEEDED | -- | details |
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)
checked = [False for _k in range(n)]
while False in checked:
checked[node] = True
color_opts = [1,2,3,4,5,6]
next_node = 0
for neigh in neighbors[node]:
if not checked[neigh]:
next_node = neigh
cn = colors[neigh]
if cn != 0 and (cn in color_opts):
color_opts.remove(colors[neigh])
colors[node] = min(color_opts)
node = next_node
print(colors)Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 6 1 2 2 3 3 1 2 4 ... |
| correct output |
|---|
| 2 3 1 2 1 |
| user output |
|---|
| [1, 3, 2, 2, 1] |
Test 2
Verdict: WRONG ANSWER
| 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, 4, 3, 1, 3, 1, 3, 1, 3, 1,... |
Test 3
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 4
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 2 1 1 2 |
| correct output |
|---|
| 2 1 |
| user output |
|---|
| [1, 2] |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 5 7 3 1 3 4 2 4 2 5 ... |
| correct output |
|---|
| 1 3 3 2 1 |
| user output |
|---|
| [1, 2, 2, 3, 1] |
Test 7
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 9 10 4 6 5 8 9 6 5 4 ... |
| correct output |
|---|
| 3 2 1 1 3 2 1 1 1 |
| user output |
|---|
| (empty) |
Test 8
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 19
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 20
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 21
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 22
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 23
Verdict: TIME LIMIT EXCEEDED
| 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) |
Test 24
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 25
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 26
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
Test 27
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| (empty) |
