結果

問題 No.2712 Play more!
ユーザー nikoro256nikoro256
提出日時 2024-03-31 15:14:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 88,328 KB
最終ジャッジ日時 2024-03-31 15:14:56
合計ジャッジ時間 14,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 1,180 ms
87,948 KB
testcase_08 AC 1,179 ms
88,328 KB
testcase_09 AC 1,153 ms
87,948 KB
testcase_10 WA -
testcase_11 AC 310 ms
76,684 KB
testcase_12 AC 1,046 ms
77,964 KB
testcase_13 AC 257 ms
76,556 KB
testcase_14 AC 790 ms
77,584 KB
testcase_15 AC 1,274 ms
78,604 KB
testcase_16 AC 145 ms
76,540 KB
testcase_17 AC 90 ms
76,176 KB
testcase_18 AC 196 ms
76,304 KB
testcase_19 AC 116 ms
76,176 KB
testcase_20 AC 317 ms
76,920 KB
testcase_21 AC 173 ms
76,644 KB
testcase_22 AC 1,074 ms
77,964 KB
testcase_23 AC 96 ms
76,388 KB
testcase_24 AC 200 ms
76,560 KB
testcase_25 AC 85 ms
74,364 KB
testcase_26 AC 216 ms
76,432 KB
testcase_27 AC 1,056 ms
76,824 KB
testcase_28 AC 188 ms
76,488 KB
testcase_29 AC 200 ms
76,432 KB
testcase_30 AC 1,088 ms
77,964 KB
testcase_31 AC 81 ms
76,940 KB
testcase_32 AC 91 ms
76,940 KB
testcase_33 AC 45 ms
61,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
edges=[]
for i in range(N):
    edges.append([i,N+i,-A[i]])
for _ in range(M):
    a,b,c=map(int,input().split())
    edges.append([N+a-1,b-1,c])
ans=[10**40 for _ in range(2*N)]
ans[0]=0
for i in range(2*N+2):
    update=False
    for a,b,c in edges:
        if ans[b]>ans[a]+c:
            ans[b]=ans[a]+c
            update=True
    #print(ans)
    if not update:
        break

    if i==2*N+1:
        print('inf')
        exit(0)
print(-ans[-1])
0