結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-12 09:51:27 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 234 bytes |
| 記録 | |
| コンパイル時間 | 315 ms |
| コンパイル使用メモリ | 85,772 KB |
| 実行使用メモリ | 53,944 KB |
| 最終ジャッジ日時 | 2026-03-17 03:42:25 |
| 合計ジャッジ時間 | 1,317 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
n,k = map(int,input().split())
an = sorted(list(map(int,input().split())))[::-1]
count = an[0]
i_c = 1
for i in range(1,len(an)):
if an[i]<0 or i_c>=k:
break
else:
count+=an[i]
i_c+=1
print(count)