結果

問題 No.1046 Fruits Rush
ユーザー roarisroaris
提出日時 2020-05-08 21:55:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 71,992 KB
最終ジャッジ日時 2023-09-17 02:42:36
合計ジャッジ時間 2,837 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,632 KB
testcase_01 AC 95 ms
71,752 KB
testcase_02 AC 95 ms
71,868 KB
testcase_03 AC 96 ms
71,864 KB
testcase_04 AC 96 ms
71,460 KB
testcase_05 AC 96 ms
71,752 KB
testcase_06 AC 95 ms
71,632 KB
testcase_07 AC 94 ms
71,912 KB
testcase_08 AC 94 ms
71,756 KB
testcase_09 AC 95 ms
71,784 KB
testcase_10 AC 95 ms
71,880 KB
testcase_11 AC 95 ms
71,752 KB
testcase_12 AC 93 ms
71,992 KB
testcase_13 AC 93 ms
71,772 KB
testcase_14 AC 95 ms
71,660 KB
testcase_15 AC 96 ms
71,660 KB
testcase_16 AC 93 ms
71,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0]

for i in range(1, K):
    if A[i]>0:
        ans += A[i]
    else:
        break

print(ans)
0