結果
| 問題 | No.1473 おでぶなおばけさん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-19 19:30:15 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 634 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 65,476 KB |
| 実行使用メモリ | 111,040 KB |
| 最終ジャッジ日時 | 2026-10-13 12:48:24 |
| 合計ジャッジ時間 | 32,234 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 TLE * 1 |
ソースコード
from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
s,t,d=map(int,input().split())
s-=1;t-=1
g[s].append([t,d])
g[t].append([s,d])
def bfs(w):
dst=[-1]*n
dst[0]=0
q=deque()
q.append(0)
while q:
now=q.popleft()
for to,limit in g[now]:
if limit<w:
continue
if dst[to]!=-1:
continue
dst[to]=dst[now]+1
q.append(to)
return dst[-1]
l=0
r=10**9+10
while r-l>1:
mid=(r+l)//2
if bfs(mid)==-1:
r=mid
else:
l=mid
print(l,bfs(l))