結果

問題 No.2370 He ate many cakes
ユーザー とりゐ
提出日時 2023-07-04 00:09:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 361 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 228,020 KB
最終ジャッジ日時 2024-07-17 21:44:33
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
tmp=[0]
for i in a:
  tmp+=[j+i for j in tmp]
  tmp.sort(reverse=True)
  tmp=tmp[:k]
print(tmp[-1])
0