結果

問題 No.468 役に立つ競技プログラミング実践編
ユーザー h_nosonh_noson
提出日時 2017-06-15 23:53:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 711 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 79,872 KB
実行使用メモリ 278,844 KB
最終ジャッジ日時 2023-10-25 07:59:02
合計ジャッジ時間 6,270 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,728 KB
testcase_01 AC 41 ms
55,380 KB
testcase_02 AC 41 ms
55,380 KB
testcase_03 AC 45 ms
55,380 KB
testcase_04 AC 41 ms
55,380 KB
testcase_05 AC 45 ms
55,380 KB
testcase_06 AC 46 ms
55,380 KB
testcase_07 AC 45 ms
55,380 KB
testcase_08 AC 45 ms
55,380 KB
testcase_09 AC 45 ms
55,380 KB
testcase_10 AC 44 ms
55,380 KB
testcase_11 AC 44 ms
55,380 KB
testcase_12 AC 43 ms
55,380 KB
testcase_13 AC 44 ms
55,380 KB
testcase_14 AC 88 ms
76,792 KB
testcase_15 AC 90 ms
76,588 KB
testcase_16 AC 91 ms
76,640 KB
testcase_17 AC 92 ms
76,700 KB
testcase_18 AC 90 ms
76,468 KB
testcase_19 AC 91 ms
76,620 KB
testcase_20 AC 93 ms
76,640 KB
testcase_21 AC 96 ms
76,796 KB
testcase_22 AC 90 ms
76,680 KB
testcase_23 AC 90 ms
76,796 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,m = map(int,input().split(' '))
e = [[] for i in range(n)]
re = [[] for i in range(n)]
di = [0] * n
for i in range(m):
    a,b,c = map(int,input().split(' '))
    e[a].append((b,c))
    re[b].append((a,c))
    di[b] += 1
q = deque()
for i in range(n):
    if di[i] == 0:
        q.append(i)
t = [0] * n
while len(q):
    u = q.popleft()
    for v,c in e[u]:
        t[v] = max(t[v],t[u] + c)
        di[v] -= 1
        if di[v] == 0:
            q.append(v)
q = deque()
q.append(n-1)
cp = [False] * n
while len(q):
    u = q.popleft()
    cp[u] = True
    for v,c in re[u]:
        if not cp[v] and t[v] + c == t[u]:
            q.append(v)
print(t[ -1],"%d/%d" % (n-sum(cp),n))
0