結果
| 問題 | No.1473 おでぶなおばけさん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-04 20:09:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 498 bytes |
| 記録 | |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 84,736 KB |
| 実行使用メモリ | 110,692 KB |
| 最終ジャッジ日時 | 2026-06-04 20:10:22 |
| 合計ジャッジ時間 | 19,044 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 38 WA * 9 |
ソースコード
import heapq
n,m=map(int,input().split())
v=[[] for i in range(n)];
ans=[(1,-1)]*n
for i in range(m):
a,b,c=map(int,input().split())
a-=1;b-=1;c=-c
v[a].append((b,c));v[b].append((a,c))
hq=[]
ans[0]=(-1<<30,0);heapq.heappush(hq,(-1<<30,0,0))
while hq:
a,b,c=heapq.heappop(hq)
if ans[c]<(a,b):
continue
for i,j in v[c]:
if ans[i]>(max(a,j),b+1):
ans[i]=(max(a,j),b+1)
heapq.heappush(hq,(max(a,j),b+1,i))
print(-ans[-1][0],ans[-1][1])