結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 32 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 43 ms
53,460 KB
testcase_07 AC 294 ms
77,452 KB
testcase_08 AC 317 ms
77,688 KB
testcase_09 AC 333 ms
77,452 KB
testcase_10 WA -
testcase_11 AC 145 ms
76,432 KB
testcase_12 AC 225 ms
76,688 KB
testcase_13 AC 128 ms
76,304 KB
testcase_14 AC 172 ms
76,312 KB
testcase_15 AC 391 ms
76,796 KB
testcase_16 AC 97 ms
76,296 KB
testcase_17 AC 67 ms
72,976 KB
testcase_18 AC 116 ms
76,184 KB
testcase_19 AC 98 ms
76,184 KB
testcase_20 AC 165 ms
76,552 KB
testcase_21 AC 111 ms
76,648 KB
testcase_22 AC 270 ms
76,812 KB
testcase_23 AC 81 ms
76,392 KB
testcase_24 AC 116 ms
76,304 KB
testcase_25 AC 70 ms
73,476 KB
testcase_26 AC 107 ms
76,176 KB
testcase_27 AC 197 ms
76,192 KB
testcase_28 AC 71 ms
75,568 KB
testcase_29 AC 131 ms
76,304 KB
testcase_30 AC 272 ms
76,432 KB
testcase_31 AC 76 ms
73,980 KB
testcase_32 AC 61 ms
72,956 KB
testcase_33 AC 38 ms
55,584 KB
testcase_34 AC 35 ms
53,460 KB
testcase_35 AC 32 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())
  x-=1
  y-=1
  e+=[(x,y,z-a[x])]
X=10**20
v=[X]*n
v[0]=0
for i in range(n):
  f=0
  for x,y,z in e:
    if v[y]>v[x]+z:
      v[y]=v[x]+z
      f=1
  if f==0:
    break
print("inf" if f else -v[n-1]+a[n-1])
0