結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-08 21:29:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 216 bytes |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-03 23:50:49 |
| 合計ジャッジ時間 | 1,183 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 2 |
ソースコード
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
if K == 1:
print(A[0])
elif A[K - 1] < 0:
print(sum(filter(lambda x: x >= 0, A)))
else:
print(sum(A[:K]))