結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-20 19:25:48 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| + 346µs | |
| コード長 | 239 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 96,228 KB |
| 実行使用メモリ | 78,976 KB |
| 最終ジャッジ日時 | 2026-08-01 17:19:54 |
| 合計ジャッジ時間 | 2,501 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
bool = False
for i in range(k):
if a[i] >= 0:
bool = True
ans += max(0, a[i])
if bool:
print(ans)
else:
print(a[0])