結果
| 問題 |
No.506 限られたジャパリまん
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-12 05:52:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 733 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 76,544 KB |
| 最終ジャッジ日時 | 2024-06-28 04:25:58 |
| 合計ジャッジ時間 | 2,597 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 RE * 2 |
ソースコード
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)
convexineq