結果
| 問題 | No.2712 Play more! |
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2024-03-31 15:14:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 513 bytes |
| 記録 | |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 85,420 KB |
| 実行使用メモリ | 91,780 KB |
| 最終ジャッジ日時 | 2026-04-16 22:11:46 |
| 合計ジャッジ時間 | 10,168 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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**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])
nikoro256