結果
問題 | No.506 限られたジャパリまん |
ユーザー | convexineq |
提出日時 | 2021-02-12 05:52:24 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 733 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 87,244 KB |
実行使用メモリ | 80,036 KB |
最終ジャッジ日時 | 2023-09-10 12:57:22 |
合計ジャッジ時間 | 3,866 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,388 KB |
testcase_01 | RE | - |
testcase_02 | AC | 79 ms
75,784 KB |
testcase_03 | AC | 71 ms
71,156 KB |
testcase_04 | AC | 85 ms
76,264 KB |
testcase_05 | AC | 77 ms
75,704 KB |
testcase_06 | AC | 72 ms
71,444 KB |
testcase_07 | AC | 84 ms
76,252 KB |
testcase_08 | AC | 127 ms
77,632 KB |
testcase_09 | AC | 121 ms
77,792 KB |
testcase_10 | AC | 88 ms
76,600 KB |
testcase_11 | AC | 119 ms
77,484 KB |
testcase_12 | AC | 110 ms
77,404 KB |
testcase_13 | AC | 72 ms
71,476 KB |
testcase_14 | AC | 82 ms
75,952 KB |
testcase_15 | AC | 72 ms
71,292 KB |
testcase_16 | AC | 136 ms
77,288 KB |
testcase_17 | AC | 86 ms
76,380 KB |
testcase_18 | AC | 87 ms
76,564 KB |
testcase_19 | AC | 93 ms
76,584 KB |
testcase_20 | AC | 111 ms
77,804 KB |
testcase_21 | AC | 90 ms
76,880 KB |
testcase_22 | AC | 127 ms
77,536 KB |
testcase_23 | AC | 123 ms
77,464 KB |
testcase_24 | RE | - |
ソースコード
def solve(): dp = [[0]*w for _ in range(h)] dp[0][0] = 1 for i in range(h): for j in range(w): if i==0==j or b[i][j]==0: continue if i: dp[i][j] += dp[i-1][j] if j: dp[i][j] += dp[i][j-1] return dp[-1][-1] h,w,k,p = map(int,input().split()) h += 1; w += 1 pos = [] for _ in range(k): x,y,s = input().split() pos.append((int(x),int(y),s)) b = [[1]*w for _ in range(h)] ans = val = 0 from itertools import combinations for lst in combinations(pos,p): for x,y,s in pos: b[x][y] = 0 for x,y,s in lst: b[x][y] = 1 v = solve() if val < v: ans = (xys[2] for xys in lst) val = v print(val%(10**9+7)) for i in ans: print(i)