結果
問題 | No.1601 With Animals into Institute |
ユーザー | __matyaki__ |
提出日時 | 2022-03-21 12:37:52 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 176,220 KB |
最終ジャッジ日時 | 2024-04-17 05:50:49 |
合計ジャッジ時間 | 15,906 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
52,864 KB |
testcase_01 | AC | 46 ms
52,352 KB |
testcase_02 | AC | 46 ms
52,352 KB |
testcase_03 | AC | 167 ms
79,144 KB |
testcase_04 | AC | 163 ms
78,720 KB |
testcase_05 | AC | 167 ms
78,464 KB |
testcase_06 | AC | 2,276 ms
165,972 KB |
testcase_07 | AC | 2,369 ms
167,228 KB |
testcase_08 | AC | 2,309 ms
167,224 KB |
testcase_09 | AC | 2,467 ms
174,664 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | AC | 196 ms
78,592 KB |
testcase_19 | AC | 192 ms
79,264 KB |
testcase_20 | AC | 204 ms
78,976 KB |
testcase_21 | AC | 189 ms
78,464 KB |
testcase_22 | AC | 191 ms
79,360 KB |
testcase_23 | AC | 200 ms
78,848 KB |
testcase_24 | AC | 202 ms
79,308 KB |
testcase_25 | AC | 191 ms
79,104 KB |
testcase_26 | AC | 209 ms
79,108 KB |
testcase_27 | AC | 52 ms
52,224 KB |
testcase_28 | AC | 52 ms
52,608 KB |
testcase_29 | AC | 51 ms
52,224 KB |
testcase_30 | AC | 51 ms
52,480 KB |
testcase_31 | AC | 50 ms
52,480 KB |
testcase_32 | AC | 50 ms
53,120 KB |
testcase_33 | AC | 51 ms
52,480 KB |
testcase_34 | AC | 50 ms
52,992 KB |
testcase_35 | AC | 49 ms
52,480 KB |
testcase_36 | AC | 49 ms
52,480 KB |
testcase_37 | AC | 51 ms
52,480 KB |
testcase_38 | AC | 51 ms
52,608 KB |
ソースコード
import heapq import sys input=sys.stdin.readline n,m=map(int,input().split()) G=[[] for i in range(n)] for i in range(m): a,b,c,x=map(int,input().split()) G[a-1].append((b-1,c,x)) G[b-1].append((a-1,c,x)) d=[[float('inf') for i in range(n)] for j in range(2)] q=[] heapq.heappush(q,(0,n-1,0)) while q: d_now,now,ani=heapq.heappop(q) if ani==0: if d_now>d[0][now] or d_now>d[1][now]:continue d[0][now]=d_now else: if d_now>d[1][now]:continue d[1][now]=d_now for nxt,c,x in G[now]: if ani==0 and x==0: if d[0][nxt]>d_now+c: d[0][nxt]=d_now+c heapq.heappush(q,(d_now+c,nxt,0)) else: if d[1][nxt]>d_now+c: heapq.heappush(q,(d_now+c,nxt,1)) for d1i in d[1][:-1]: print(d1i)