QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#623217 | #5720. Coloring Contention | TheZachMan | TL | 178ms | 42156kb | Python3 | 526b | 2024-10-09 10:41:08 | 2024-10-09 10:41:08 |
Judging History
answer
n, m = map(int, input().split())
adj = {}
for i in range(n):
adj[i+1] = []
for i in range(m):
a, b = map(int, input().split())
adj[a].append(b)
adj[b].append(a)
visited = {}
stage = {1:0}
o=0
for i in range(10**8):
if o:
print(i-2)
break
ns = {}
for z in stage:
if z == n:
o=1
break
if z in visited:
pass
visited[z] = 0
for j in adj[z]:
ns[j] = 0
stage = ns
詳細信息
Test #1:
score: 100
Accepted
time: 11ms
memory: 10580kb
input:
3 3 1 3 1 2 2 3
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 10ms
memory: 10548kb
input:
7 8 1 2 1 3 2 4 3 4 4 5 4 6 5 7 6 7
output:
3
result:
ok single line: '3'
Test #3:
score: 0
Accepted
time: 178ms
memory: 42156kb
input:
100000 99999 1 82839 79117 1 52850 1 1 98692 1 97570 1 52713 1 69481 86347 1 1 78467 32605 1 1 50497 32776 1 96243 1 1 63191 1 40685 6039 1 42700 1 36636 1 14590 1 89412 1 96386 1 1 67084 74195 1 79616 1 1 7286 1 85081 82925 1 31913 1 1 21516 32383 1 1 57458 12240 1 1 93520 1 34296 36228 1 1 75440 1...
output:
0
result:
ok single line: '0'
Test #4:
score: -100
Time Limit Exceeded
input:
100000 99999 27258 66566 49213 38165 7349 35601 47068 59589 82972 21228 78010 70856 22573 21068 82303 88214 70714 58816 56991 82670 85959 16532 78640 33897 24436 19989 65698 53247 26936 48520 98934 34959 8790 31287 14159 78214 57169 40287 76148 2201 86479 91453 5488 41694 74869 54823 89247 61215 519...