結果

問題 No.2370 He ate many cakes
ユーザー komkompi
提出日時 2023-07-08 13:37:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 252,716 KB
最終ジャッジ日時 2024-07-22 09:04:15
合計ジャッジ時間 3,370 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

N,K=map(int,input().split())

A=list(map(int,input().split()))

solves=[0]

for a in A:
    temp=[]
    for solve in solves:
        temp.append(solve-a)
    
    solves+=temp
    
    solves.sort()
    solves=solves[:K]

print(-solves[-1])
0