結果
| 問題 | No.3653 Space-Time Courier |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-28 07:44:30 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,127 bytes |
| 記録 | |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 96,360 KB |
| 実行使用メモリ | 319,744 KB |
| 最終ジャッジ日時 | 2026-08-28 21:10:27 |
| 合計ジャッジ時間 | 6,625 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | TLE * 1 -- * 27 |
ソースコード
from heapq import heappush,heappop
n,m = list(map(int,input().split()))
p = list(map(int,input().split()))
s = [[10**18 for i in range(n)] for u in range(n)]
uv = [[] for i in range(n)]
for i in range(m):
u,v,c = list(map(int,input().split()))
u,v = u-1,v-1
uv[u].append((v,c))
for i in range(n):
pq = [0]
d = {0:[i]}
while len(pq):
w = heappop(pq)
while len(d[w]):
u = d[w].pop()
if s[i][u] < w:
continue
s[i][u] = w
for v,c in uv[u]:
if s[i][v] <= w+c:
continue
if w+c not in d:
d[w+c] = []
heappush(pq,w+c)
s[i][v] = w+c
d[w+c].append(v)
c = 10**18
for i in range(n):
for u in range(n):
if i == u:
continue
s[i][u] += p[i]+p[u]
c = min(s[i][u],c)
ans = 0
for i in range(n):
for u in range(n):
if i == u:
continue
if s[i][u] == c:
ans += 1
print(c,ans)