結果

問題 No.2712 Play more!
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-01 02:20:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,844 KB
最終ジャッジ日時 2024-04-01 02:20:49
合計ジャッジ時間 11,759 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 456 ms
77,076 KB
testcase_08 AC 505 ms
77,844 KB
testcase_09 AC 458 ms
77,076 KB
testcase_10 WA -
testcase_11 AC 228 ms
76,292 KB
testcase_12 AC 751 ms
76,952 KB
testcase_13 AC 196 ms
76,292 KB
testcase_14 AC 610 ms
77,076 KB
testcase_15 AC 898 ms
77,076 KB
testcase_16 AC 114 ms
76,164 KB
testcase_17 AC 74 ms
73,228 KB
testcase_18 AC 175 ms
76,188 KB
testcase_19 AC 102 ms
76,180 KB
testcase_20 AC 270 ms
76,416 KB
testcase_21 AC 116 ms
76,132 KB
testcase_22 AC 688 ms
76,820 KB
testcase_23 AC 84 ms
76,264 KB
testcase_24 AC 156 ms
76,172 KB
testcase_25 AC 73 ms
72,956 KB
testcase_26 AC 187 ms
76,300 KB
testcase_27 AC 523 ms
76,956 KB
testcase_28 AC 413 ms
76,264 KB
testcase_29 AC 165 ms
76,300 KB
testcase_30 AC 727 ms
76,948 KB
testcase_31 AC 994 ms
77,336 KB
testcase_32 AC 425 ms
77,204 KB
testcase_33 AC 48 ms
61,640 KB
testcase_34 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
g = [[] for _ in range(2 * n)]
for i in range(n):
	g[i].append((i + n, -a[i]))

for _ in range(m):
	a, b, c = map(int, input().split())
	a -= 1
	b -= 1
	g[a + n].append((b, c))

INF = 10 ** 18
dist = [INF] * (2 * n)
dist[0] = 0

for _ in range(2 * n - 1):
	for u in range(2 * n):
		for v, w in g[u]:
			dist[v] = min(dist[v], dist[u] + w)

for u in range(2 * n):
	for v, w in g[u]:
		if dist[v] > dist[u] + w:
			print("inf")
			exit()

print(-dist[-1])
0