結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 35 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 1,158 ms
86,296 KB
testcase_08 AC 1,147 ms
86,680 KB
testcase_09 AC 1,124 ms
86,296 KB
testcase_10 WA -
testcase_11 AC 313 ms
77,176 KB
testcase_12 AC 1,045 ms
78,016 KB
testcase_13 AC 279 ms
76,792 KB
testcase_14 AC 808 ms
77,848 KB
testcase_15 AC 1,241 ms
79,128 KB
testcase_16 AC 148 ms
76,656 KB
testcase_17 AC 91 ms
76,432 KB
testcase_18 AC 198 ms
76,564 KB
testcase_19 AC 119 ms
76,308 KB
testcase_20 AC 343 ms
77,320 KB
testcase_21 AC 175 ms
77,168 KB
testcase_22 AC 1,081 ms
78,360 KB
testcase_23 AC 98 ms
76,912 KB
testcase_24 AC 205 ms
76,676 KB
testcase_25 AC 87 ms
76,656 KB
testcase_26 AC 213 ms
76,688 KB
testcase_27 AC 1,033 ms
77,080 KB
testcase_28 AC 177 ms
76,368 KB
testcase_29 AC 191 ms
76,808 KB
testcase_30 AC 1,087 ms
78,232 KB
testcase_31 AC 86 ms
77,464 KB
testcase_32 AC 105 ms
77,464 KB
testcase_33 AC 46 ms
61,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
edge=[[] for _ in range(N)]
edges=[]
for i in range(N):
    edges.append([i,N+i,-A[i]])
for _ in range(M):
    a,b,c=map(int,input().split())
    edge[a-1].append([b-1,c])
    edges.append([N+a-1,b-1,c])
ans=[10**22 for _ in range(2*N)]
ans[0]=0
for i in range(2*N):
    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