結果
問題 |
No.1473 おでぶなおばけさん
|
ユーザー |
|
提出日時 | 2021-04-25 17:56:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 79 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 60,576 KB |
最終ジャッジ日時 | 2024-07-04 09:34:01 |
合計ジャッジ時間 | 4,898 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 46 |
ソースコード
n, m = map(int, input().split()) V = [[0, 0, []] for _ in range(n)] for _ in range(m): s, t, d = map(int, input().split()) V[s-1][2].append((t-1, d)) V[t-1][2].append((s-1, d)) q = [] for v, d in V[0][2]: q.append((v, d, 1)) while len(q) > 0: v, d, n = q.pop(0) if V[v][0] < d: V[v][0] = d V[v][1] = n elif V[v][0] == d and V[v][1] > n: V[v][0] = n elif v != 0: continue for i, w in V[v][2]: if i != 0: q.append((i, min(d, w), n + 1)) print(V[n-1][0], V[n-1][1])