結果

問題 No.2712 Play more!
ユーザー prd_xxxprd_xxx
提出日時 2024-03-31 14:47:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,788 KB
最終ジャッジ日時 2024-03-31 14:48:00
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 268 ms
74,228 KB
testcase_10 AC 36 ms
53,460 KB
testcase_11 AC 148 ms
74,248 KB
testcase_12 AC 204 ms
76,664 KB
testcase_13 AC 144 ms
74,380 KB
testcase_14 WA -
testcase_15 AC 264 ms
76,660 KB
testcase_16 AC 123 ms
76,396 KB
testcase_17 AC 78 ms
73,488 KB
testcase_18 AC 95 ms
73,008 KB
testcase_19 AC 82 ms
73,008 KB
testcase_20 AC 160 ms
76,396 KB
testcase_21 AC 117 ms
76,652 KB
testcase_22 AC 182 ms
76,276 KB
testcase_23 AC 90 ms
76,524 KB
testcase_24 AC 118 ms
74,380 KB
testcase_25 AC 80 ms
74,604 KB
testcase_26 AC 99 ms
73,000 KB
testcase_27 WA -
testcase_28 AC 80 ms
66,348 KB
testcase_29 AC 108 ms
73,744 KB
testcase_30 AC 256 ms
76,280 KB
testcase_31 AC 196 ms
76,788 KB
testcase_32 AC 165 ms
76,532 KB
testcase_33 AC 47 ms
62,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))
ABC = [tuple(map(int,input().split())) for _ in range(M)]

INF = 10**18
dist = [INF] * N
dist[0] = -A[0]
for i in range(N):
    for a,b,c in ABC:
        a,b = a-1,b-1
        dd = c - A[b]
        if dist[b] > dist[a] + dd:
            dist[b] = dist[a] + dd
            if i==N-1 and b == N-1:
                exit(print('inf'))

print(-dist[-1])
0