結果

問題 No.2712 Play more!
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-04-05 14:37:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,684 KB
最終ジャッジ日時 2024-04-05 14:37:13
合計ジャッジ時間 6,446 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 33 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 33 ms
53,460 KB
testcase_07 AC 290 ms
77,452 KB
testcase_08 AC 287 ms
77,684 KB
testcase_09 AC 262 ms
77,452 KB
testcase_10 WA -
testcase_11 AC 146 ms
76,432 KB
testcase_12 AC 260 ms
76,688 KB
testcase_13 AC 139 ms
76,304 KB
testcase_14 AC 170 ms
76,312 KB
testcase_15 AC 412 ms
76,796 KB
testcase_16 AC 103 ms
76,296 KB
testcase_17 AC 65 ms
72,972 KB
testcase_18 AC 102 ms
76,184 KB
testcase_19 AC 83 ms
76,184 KB
testcase_20 AC 179 ms
76,552 KB
testcase_21 AC 113 ms
76,648 KB
testcase_22 AC 277 ms
76,804 KB
testcase_23 AC 80 ms
76,392 KB
testcase_24 AC 114 ms
76,304 KB
testcase_25 AC 68 ms
73,476 KB
testcase_26 AC 97 ms
76,176 KB
testcase_27 AC 198 ms
76,192 KB
testcase_28 AC 90 ms
75,568 KB
testcase_29 AC 109 ms
76,432 KB
testcase_30 AC 285 ms
76,432 KB
testcase_31 AC 468 ms
74,492 KB
testcase_32 AC 278 ms
73,468 KB
testcase_33 AC 43 ms
61,552 KB
testcase_34 AC 34 ms
53,460 KB
testcase_35 AC 33 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=list(map(int,input().split()))
e=[]
for i in range(m):
  x,y,z=map(int,input().split())
  e+=[(x-1,y-1,z-a[x-1])]
X=10**20
v=[X]*n
v[0]=0
for i in range(n+1):
  f=0
  for x,y,z in e:
    if v[y]>v[x]+z:
      v[y]=v[x]+z
      f=1
print("inf" if f else -v[n-1]+a[n-1])
0