結果
| 問題 |
No.1473 おでぶなおばけさん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-19 19:29:54 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 634 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 83,256 KB |
| 最終ジャッジ日時 | 2024-11-23 13:53:54 |
| 合計ジャッジ時間 | 65,208 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 TLE * 6 |
ソースコード
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))