結果

問題 No.2329 Nafmo、イカサマをする
ユーザー AyunaAyuna
提出日時 2023-05-28 15:37:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 63,964 KB
最終ジャッジ日時 2024-06-08 08:08:14
合計ジャッジ時間 2,617 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
52,888 KB
testcase_01 AC 33 ms
52,068 KB
testcase_02 AC 33 ms
52,200 KB
testcase_03 AC 32 ms
51,936 KB
testcase_04 AC 31 ms
52,408 KB
testcase_05 AC 33 ms
52,048 KB
testcase_06 AC 32 ms
52,164 KB
testcase_07 AC 31 ms
51,884 KB
testcase_08 WA -
testcase_09 AC 31 ms
52,472 KB
testcase_10 AC 31 ms
52,424 KB
testcase_11 AC 31 ms
52,660 KB
testcase_12 WA -
testcase_13 AC 36 ms
52,300 KB
testcase_14 WA -
testcase_15 AC 35 ms
52,160 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 32 ms
52,548 KB
testcase_25 WA -
testcase_26 AC 33 ms
52,352 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 32 ms
52,156 KB
testcase_32 AC 32 ms
52,104 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [[0 for _ in range(k + 1)] for _ in range(n + 1)]
a.sort()
#dp[i][j] = i番目までのカードを見て、j枚選んでいるM以下の最大値
for i in range(1, n + 1):
    for j in range(k + 1):
        for l in range(0, k - j + 1):
            if dp[i - 1][j] + a[i - 1] * l > m: continue
            dp[i][j + l] = max(dp[i][j + l], dp[i - 1][j] + a[i - 1] * l)
ans = 0
for i in range(n + 1):
    if ans < dp[i][-1]:
        ans = dp[i][-1]
print(ans)
0