結果

問題 No.1457 ツブ消ししとるなHard
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-01 09:38:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 85,016 KB
最終ジャッジ日時 2023-08-22 14:30:56
合計ジャッジ時間 3,594 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
76,044 KB
testcase_01 AC 81 ms
75,880 KB
testcase_02 AC 79 ms
75,876 KB
testcase_03 AC 78 ms
75,872 KB
testcase_04 AC 147 ms
85,016 KB
testcase_05 AC 124 ms
82,404 KB
testcase_06 AC 138 ms
84,760 KB
testcase_07 AC 130 ms
84,408 KB
testcase_08 AC 94 ms
78,504 KB
testcase_09 AC 96 ms
78,760 KB
testcase_10 AC 95 ms
78,836 KB
testcase_11 AC 82 ms
75,964 KB
testcase_12 AC 141 ms
84,912 KB
testcase_13 AC 93 ms
78,136 KB
testcase_14 AC 94 ms
78,012 KB
testcase_15 AC 106 ms
79,152 KB
testcase_16 AC 94 ms
79,936 KB
testcase_17 AC 94 ms
78,776 KB
testcase_18 AC 76 ms
75,712 KB
testcase_19 AC 132 ms
84,576 KB
testcase_20 AC 76 ms
75,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x,y,z = map(int,input().split())
A = list(map(int,input().split()))

dp = [[0]*3005 for i in range(n+1)]
dp[0][0] = 1
need = 0
for a in A:
    if a <= y:
        continue
    ndp = [[0]*3005 for i in range(n+1)]
    if a >= x:
        need += 1
        for i in range(n):
            for j in range(3000):
                if dp[i][j]:
                    ndp[i+1][j+a] += dp[i][j]
    else:
        for i in range(n):
            for j in range(3000):
                if dp[i][j]:
                    ndp[i+1][j+a] += dp[i][j]
                    ndp[i][j] += dp[i][j]

    dp = ndp

if need > m:
    print("Handicapped")
    exit()
ans = 0
for i in range(1,m+1):
    ans += dp[i][i*z]

print(ans)
0