結果

問題 No.1046 Fruits Rush
ユーザー uni_pythonuni_python
提出日時 2020-06-19 00:07:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 71,564 KB
最終ジャッジ日時 2023-09-16 12:29:55
合計ジャッジ時間 2,452 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,480 KB
testcase_01 AC 70 ms
71,400 KB
testcase_02 AC 71 ms
71,368 KB
testcase_03 AC 70 ms
71,148 KB
testcase_04 AC 70 ms
71,480 KB
testcase_05 AC 71 ms
71,408 KB
testcase_06 AC 71 ms
71,320 KB
testcase_07 AC 69 ms
71,536 KB
testcase_08 AC 70 ms
71,460 KB
testcase_09 AC 70 ms
71,288 KB
testcase_10 AC 70 ms
71,556 KB
testcase_11 AC 71 ms
71,328 KB
testcase_12 AC 70 ms
71,564 KB
testcase_13 AC 69 ms
71,276 KB
testcase_14 AC 69 ms
71,436 KB
testcase_15 AC 69 ms
71,412 KB
testcase_16 AC 69 ms
71,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    N,K=MI()
    A=LI()
    A.sort(reverse=True)
    ans=A[0]
    for i in range(1,min(N,K)):
        temp=ans+A[i]
        if temp>ans:
            ans=temp
        else:
            break
    print(ans)
    


main()
0