結果
| 問題 | No.1457 ツブ消ししとるなHard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:57:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| 記録 | |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 82,920 KB |
| 実行使用メモリ | 67,200 KB |
| 最終ジャッジ日時 | 2024-12-15 18:30:24 |
| 合計ジャッジ時間 | 1,644 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 WA * 1 |
ソースコード
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
n,m,x,y,z = list(map(int, input().split()))
V = "Handicapped"
a = list(map(int, input().split()))
b = [a[i] for i in range(n) if a[i]>=x]
a = [a[i]-z for i in range(n) if x>a[i]>y]
if len(b)>m:
print(V)
else:
from collections import defaultdict
target = z*len(b) - sum(b)
dp = defaultdict(int)
dp[0] = 1
for i in range(len(a)):
v = a[i]
ndp = defaultdict(int)
for k in dp:
ndp[k] += dp[k]
ndp[k+v] += dp[k]
dp = ndp
# print(dp, v)
ans = dp[target]
if target==0 and len(b)==0:
ans -= 1
print(ans)