結果

問題 No.1046 Fruits Rush
ユーザー koba-e964koba-e964
提出日時 2020-05-10 10:57:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 71,572 KB
最終ジャッジ日時 2023-09-21 13:03:06
合計ジャッジ時間 2,603 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,248 KB
testcase_01 AC 74 ms
71,572 KB
testcase_02 AC 73 ms
71,324 KB
testcase_03 AC 76 ms
71,224 KB
testcase_04 AC 74 ms
71,260 KB
testcase_05 AC 74 ms
71,248 KB
testcase_06 AC 74 ms
71,252 KB
testcase_07 AC 78 ms
71,556 KB
testcase_08 AC 75 ms
71,468 KB
testcase_09 AC 75 ms
71,432 KB
testcase_10 AC 74 ms
71,228 KB
testcase_11 AC 74 ms
71,300 KB
testcase_12 AC 73 ms
71,092 KB
testcase_13 AC 74 ms
71,336 KB
testcase_14 AC 75 ms
71,384 KB
testcase_15 AC 74 ms
71,220 KB
testcase_16 AC 75 ms
71,204 KB
権限があれば一括ダウンロードができます

ソースコード

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