結果

問題 No.2370 He ate many cakes
ユーザー komkompikomkompi
提出日時 2023-07-08 13:37:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 255,336 KB
最終ジャッジ日時 2023-09-29 14:52:53
合計ジャッジ時間 4,999 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,224 KB
testcase_01 AC 71 ms
71,032 KB
testcase_02 AC 70 ms
71,336 KB
testcase_03 AC 203 ms
170,400 KB
testcase_04 AC 71 ms
71,124 KB
testcase_05 AC 70 ms
71,132 KB
testcase_06 AC 69 ms
71,128 KB
testcase_07 AC 70 ms
71,356 KB
testcase_08 AC 69 ms
71,240 KB
testcase_09 AC 70 ms
70,968 KB
testcase_10 AC 82 ms
78,572 KB
testcase_11 AC 122 ms
113,340 KB
testcase_12 AC 241 ms
205,484 KB
testcase_13 AC 320 ms
251,132 KB
testcase_14 AC 143 ms
128,020 KB
testcase_15 AC 390 ms
254,488 KB
testcase_16 AC 328 ms
254,072 KB
testcase_17 AC 374 ms
255,336 KB
testcase_18 AC 99 ms
99,976 KB
testcase_19 AC 69 ms
71,340 KB
権限があれば一括ダウンロードができます

ソースコード

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