結果

問題 No.1046 Fruits Rush
ユーザー koba-e964
提出日時 2020-05-10 10:57:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 51,840 KB
最終ジャッジ日時 2024-07-07 06:47:13
合計ジャッジ時間 1,553 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

n, k = map(int, readline().split())
a = list(map(int, readline().split()))

a.sort()
a.reverse()

tot = a[0]
for i in range(1, k):
    tot += max(a[i], 0)
print(tot)

0