結果
問題 | No.506 限られたジャパリまん |
ユーザー | nanae |
提出日時 | 2017-04-21 22:55:59 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,079 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 10,888 KB |
実行使用メモリ | 8,444 KB |
最終ジャッジ日時 | 2023-09-10 12:51:23 |
合計ジャッジ時間 | 2,737 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,260 KB |
testcase_01 | AC | 17 ms
8,324 KB |
testcase_02 | AC | 16 ms
8,216 KB |
testcase_03 | AC | 16 ms
8,368 KB |
testcase_04 | AC | 19 ms
8,352 KB |
testcase_05 | AC | 16 ms
8,348 KB |
testcase_06 | AC | 16 ms
8,388 KB |
testcase_07 | AC | 19 ms
8,436 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 236 ms
8,300 KB |
testcase_12 | WA | - |
testcase_13 | AC | 16 ms
8,188 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 37 ms
8,340 KB |
testcase_20 | AC | 69 ms
8,444 KB |
testcase_21 | AC | 30 ms
8,240 KB |
testcase_22 | WA | - |
testcase_23 | AC | 55 ms
8,236 KB |
testcase_24 | WA | - |
ソースコード
import sys from itertools import combinations mod = 10**9 + 7 def solve(): h, w, k, p = map(int, input().split()) fr = [] for i in range(k): x, y, name = input().split() x = int(x) y = int(y) fr.append((x, y, name)) max_keiro = -1 omit = [] for cmb in combinations(range(k), k - p): dp = [[0]*(h + 1) for i in range(w + 1)] for x in range(h + 1): dp[0][x] = 1 for y in range(w + 1): dp[y][0] = 1 taboo = [[False]*(h + 1) for i in range(w + 1)] for i in cmb: x, y, name = fr[i] taboo[y][x] = True for y in range(1, w + 1): for x in range(1, h + 1): if taboo[y][x]: continue dp[y][x] = dp[y - 1][x] + dp[y][x - 1] if dp[w][h] > max_keiro: max_keiro = dp[w][h] omit = set(cmb) print(max_keiro % mod) for i in range(k): if i not in omit: print(fr[i][2]) if __name__ == '__main__': solve()