結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-20 19:25:48 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 239 bytes |
| 記録 | |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 85,084 KB |
| 実行使用メモリ | 51,968 KB |
| 最終ジャッジ日時 | 2026-03-18 22:17:34 |
| 合計ジャッジ時間 | 1,168 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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])