結果
| 問題 | No.3158 Collect Stamps |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-18 11:15:40 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 111 ms / 2,000 ms |
| + 657µs | |
| コード長 | 347 bytes |
| 記録 | |
| コンパイル時間 | 72 ms |
| コンパイル使用メモリ | 64,712 KB |
| 実行使用メモリ | 59,324 KB |
| 最終ジャッジ日時 | 2026-10-29 13:31:30 |
| 合計ジャッジ時間 | 3,480 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
from itertools import permutations
N, M, K = map(int, input().split())
A = set(map(lambda x: int(x) - 1, input().split()))
T = [list(map(int, input().split())) for _ in range(N)]
ans = 10 ** 18
for p in permutations(range(N), M):
if p[-1] not in A:
continue
ans = min(ans, sum(T[p[i]][p[i+1]] for i in range(M-1)))
print(ans)