結果
| 問題 |
No.506 限られたジャパリまん
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-07-18 02:03:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 865 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 82,232 KB |
| 実行使用メモリ | 77,188 KB |
| 最終ジャッジ日時 | 2024-06-28 04:30:03 |
| 合計ジャッジ時間 | 5,295 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 7 RE * 14 |
ソースコード
import sys
input = sys.stdin.readline
H,W,K,P=map(int,input().split())
mod=10**9+7
F=[input().split() for i in range(K)]
for i in range(K):
F[i][0]=int(F[i][0])
F[i][1]=int(F[i][1])
MAX=0
ind=0
for i in range(1<<K):
DP=[[0]*(W+1) for i in range(H+1)]
DP[0][0]=1
p=0
for j in range(K):
if i & (1<<j) == 0:
x,y,_ = F[j]
DP[y][x]=-1
else:
p+=1
if p>P:
continue
for j in range(H+1):
for k in range(W+1):
if DP[j][k]!=-1:
if j-1>=0 and DP[j-1][k]!=-1:
DP[j][k]+=DP[j-1][k]
if k-1>=0 and DP[j][k-1]!=-1:
DP[j][k]+=DP[j][k-1]
if DP[-1][-1]>MAX:
MAX=DP[-1][-1]
ind=i
print(MAX)
for j in range(K):
if ind & (1<<j) != 0:
print(F[j][2])
titia