結果

問題 No.2329 Nafmo、イカサマをする
ユーザー gew1fw
提出日時 2025-06-12 12:53:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 54,128 KB
最終ジャッジ日時 2025-06-12 12:55:45
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
a = list(map(int, input().split())) if n > 0 else []
a.sort(reverse=True)

max_sum = 0

for t in range(0, k + 1):
    current_sum = 0
    rem = t
    for num in a:
        if rem == 0:
            break
        if num == 0:
            current_sum += 0 * rem
            rem = 0
            break
        max_possible = (m - current_sum) // num
        cnt = min(rem, max_possible)
        current_sum += cnt * num
        rem -= cnt
    if current_sum <= m and current_sum > max_sum:
        max_sum = current_sum

print(max_sum)
0