結果
| 問題 |
No.1457 ツブ消ししとるなHard
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-05-05 21:13:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 2,000 ms |
| コード長 | 434 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 82,292 KB |
| 実行使用メモリ | 83,380 KB |
| 最終ジャッジ日時 | 2024-09-13 14:05:58 |
| 合計ジャッジ時間 | 2,106 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
n,m,x,y,z = map(int,input().split())
*a, = map(int,input().split())
from collections import defaultdict
dp = defaultdict(int)
dp[(0,0)] = 1
V = C = 0
for ai in a:
if ai >= x:
V += ai-z
C += 1
elif ai > y:
ndp = dp.copy()
for (v,c),r in dp.items():
ndp[(v+ai-z,c+1)] += r
dp = ndp
print(sum(dp[(-V,i)] for i in range(m+1-C)) - (1 if C==0 else 0) if C <= m else "Handicapped")
convexineq