結果

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

ソースコード

diff #

N, M, K = map(int, input().split())
A = list(map(int, input().split())) if N > 0 else []

max_A = max(A) if A else 0
max_candidate = 0

for t in range(0, K + 1):
    if t == 0:
        current_sum = 0
    else:
        base = (t - 1) * max_A
        if base > M:
            continue
        remaining = M - base
        max_x = -1
        for a in A:
            if a <= remaining and a > max_x:
                max_x = a
        if max_x == -1:
            continue
        current_sum = base + max_x
    if current_sum <= M and current_sum > max_candidate:
        max_candidate = current_sum

print(max_candidate)
0