結果
問題 |
No.2329 Nafmo、イカサマをする
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:22:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 703 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 54,504 KB |
最終ジャッジ日時 | 2025-06-12 18:22:42 |
合計ジャッジ時間 | 2,748 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 26 |
ソースコード
n, m, k = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) max_a = a[0] if n > 0 else 0 current_max = 0 result = 0 for t in range(1, k + 1): if n == 0: break # No cards available temp = current_max + max_a if temp <= m: current_max = temp result = max(result, current_max) else: found = False for ai in a: if current_max + ai <= m: current_max += ai result = max(result, current_max) found = True break if not found: # Cannot draw this step, but previous steps are already considered pass print(result)