結果
| 問題 |
No.1457 ツブ消ししとるなHard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 10:53:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 320 ms / 2,000 ms |
| コード長 | 602 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 82,272 KB |
| 実行使用メモリ | 99,460 KB |
| 最終ジャッジ日時 | 2024-11-24 19:41:36 |
| 合計ジャッジ時間 | 4,161 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
from bisect import *
N,M,X,Y,Z = map(int,input().split())
A = list(map(int,input().split()))
y = bisect_right(A,Y)
x = bisect_left(A,X)
if N-x > M:
print("Handicapped")
exit(0)
s = 2500
dp = [[0]*(s*2+100) for i in range(M+1)]
dp[0][0] = 1
for a in A:
nxt = [[0]*(s*2+100) for i in range(M+1)]
for i in range(M+1):
for j in range(-s,s+1):
if i+1 <= M and Y < a and -s <= j+a-Z <= s:
nxt[i+1][j+a-Z] += dp[i][j]
if a < X:
nxt[i][j] += dp[i][j]
dp = nxt
ans = 0
for i in range(1,M+1):
ans += dp[i][0]
print(ans)