結果
| 問題 |
No.506 限られたジャパリまん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-06 09:51:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 691 bytes |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-06-28 04:24:50 |
| 合計ジャッジ時間 | 5,844 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 19 |
ソースコード
import itertools
H, W, K, P = map(int, input().split())
coordinates = dict()
name = [''] * K
for i in range(K):
x, y, n = input().split()
coordinates[(int(y), int(x))] = i
name[i] = n
ans = 0
indices = ()
for t in itertools.combinations(range(K), P):
table = [[0] * (H + 2) for _ in range(W + 2)]
table[1][1] = 1
it = itertools.product(range(W + 1), range(H + 1))
next(it)
for w, h in it:
if (w, h) not in coordinates or coordinates[(w, h)] in t:
table[w + 1][h + 1] = table[w][h + 1] + table[w + 1][h]
if ans < table[W + 1][H + 1]:
indices = t
ans = table[W + 1][H + 1]
print(ans)
for i in indices:
print(name[i])