結果
| 問題 |
No.2712 Play more!
|
| ユーザー |
nikoro256
|
| 提出日時 | 2024-03-31 15:10:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 513 bytes |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 82,220 KB |
| 実行使用メモリ | 86,444 KB |
| 最終ジャッジ日時 | 2024-09-30 20:21:09 |
| 合計ジャッジ時間 | 12,676 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 2 |
ソースコード
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**22 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])
nikoro256