結果
問題 | No.1046 Fruits Rush |
ユーザー |
|
提出日時 | 2020-05-08 21:32:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 1,101 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,440 KB |
実行使用メモリ | 65,288 KB |
最終ジャッジ日時 | 2024-07-04 00:02:59 |
合計ジャッジ時間 | 1,753 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
# Template 1.0import sys, refrom collections import deque, defaultdict, Counter, OrderedDictfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radiansfrom heapq import heappush, heappop, heapify, nlargest, nsmallestdef 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 toretdef sortDictWithKey(passedDic):return dict(OrderedDict(sorted(passedDic.items())))sys.setrecursionlimit(10 ** 9)INF = float('inf')mod = 10 ** 9 + 7n, k = MAP()a = LIST()a.sort()a = a[::-1]temp = a[:k]if(temp[0]>0):ans = 0for el in temp:if(el>0):ans+=elelse:breakprint(ans)else:print(temp[0])