結果

問題 No.17 2つの地点に泊まりたい
ユーザー square1001square1001
提出日時 2022-02-17 14:35:46
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-09-11 17:41:22
合計ジャッジ時間 1,879 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,868 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 17 ms
7,884 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 14 ms
7,836 KB
testcase_13 AC 14 ms
7,944 KB
testcase_14 AC 15 ms
7,892 KB
testcase_15 AC 14 ms
7,888 KB
testcase_16 AC 14 ms
7,788 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# Input
N = int(input())
S = [ int(input()) for i in range(N) ]
M = int(input())
d = [ [ 10 ** 10 ] * N for i in range(N) ]
for i in range(M):
	A, B, C = map(int, input().split())
	d[A][B] = min(d[A][B], C)
	d[B][A] = min(d[B][A], C)

# Brute Force
answer = 10 ** 10
for i in range(0, N):
	for j in range(0, N):
		answer = min(answer, d[0][i] + d[i][j] + d[j][N - 1] + S[i] + S[j])

# Output
print(answer)
0