結果

問題 No.507 ゲーム大会(チーム決め)
ユーザー convexineqconvexineq
提出日時 2021-02-12 05:53:03
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 713 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 86,568 KB
実行使用メモリ 78,988 KB
最終ジャッジ日時 2023-09-25 19:49:31
合計ジャッジ時間 5,128 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0