結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 12:56:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 703 bytes |
| コンパイル時間 | 473 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2025-06-12 13:01:35 |
| 合計ジャッジ時間 | 3,429 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
gew1fw