結果

問題 No.1046 Fruits Rush
ユーザー Shivam SinghShivam Singh
提出日時 2020-05-08 21:30:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 80,104 KB
最終ジャッジ日時 2023-09-17 01:42:46
合計ジャッジ時間 4,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
79,692 KB
testcase_01 AC 136 ms
79,884 KB
testcase_02 AC 135 ms
79,856 KB
testcase_03 AC 134 ms
79,776 KB
testcase_04 AC 137 ms
79,608 KB
testcase_05 AC 137 ms
79,900 KB
testcase_06 AC 137 ms
79,832 KB
testcase_07 AC 135 ms
79,872 KB
testcase_08 AC 134 ms
79,864 KB
testcase_09 AC 137 ms
79,796 KB
testcase_10 AC 137 ms
79,804 KB
testcase_11 AC 134 ms
79,612 KB
testcase_12 AC 132 ms
79,832 KB
testcase_13 AC 135 ms
79,872 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k = MAP()

a = LIST()

a.sort()

a = a[::-1]
temp = a[:k]
ans = 0
for el in temp:
    if(el>0):
        ans+=el
    else:
        break
print(ans)
0