結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-24 17:00:15 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 314 bytes |
| 記録 | |
| コンパイル時間 | 409 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-03-24 17:00:21 |
| 合計ジャッジ時間 | 3,698 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 9 WA * 5 |
ソースコード
n, k = map(int, input().split())
a = list(map(int, input().split()))
reverse_a = sorted(a, reverse=True)
changed_index = 0
for i in range(n):
if reverse_a[i] > 0:
changed_index += 1
if k > changed_index:
print(sum(reverse_a[:changed_index]))
elif k == changed_index:
print(sum(reverse_a[:k]))