結果

問題 No.2424 Josouzai
ユーザー YU HiroseYU Hirose
提出日時 2024-04-25 14:27:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,772 KB
最終ジャッジ日時 2024-04-25 14:27:19
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 70 ms
17,232 KB
testcase_05 AC 193 ms
32,772 KB
testcase_06 AC 195 ms
32,408 KB
testcase_07 AC 217 ms
32,360 KB
testcase_08 AC 195 ms
32,772 KB
testcase_09 AC 27 ms
10,624 KB
testcase_10 AC 60 ms
16,508 KB
testcase_11 AC 124 ms
27,604 KB
testcase_12 AC 97 ms
23,264 KB
testcase_13 AC 72 ms
17,316 KB
testcase_14 AC 114 ms
22,572 KB
testcase_15 AC 37 ms
12,672 KB
testcase_16 AC 169 ms
29,756 KB
testcase_17 AC 69 ms
15,592 KB
testcase_18 AC 67 ms
16,564 KB
testcase_19 AC 99 ms
20,824 KB
testcase_20 AC 168 ms
30,388 KB
testcase_21 AC 130 ms
25,672 KB
testcase_22 AC 71 ms
17,284 KB
testcase_23 AC 84 ms
18,832 KB
testcase_24 AC 50 ms
14,588 KB
testcase_25 AC 181 ms
31,492 KB
testcase_26 AC 136 ms
25,468 KB
testcase_27 AC 215 ms
31,968 KB
testcase_28 AC 161 ms
29,032 KB
testcase_29 AC 170 ms
27,152 KB
testcase_30 AC 52 ms
14,520 KB
testcase_31 AC 91 ms
20,156 KB
testcase_32 AC 184 ms
31,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
acc = list(accumulate(a))
cnt = 0

for i in range(n):
    if acc[i] <= k:
        cnt += 1
print(cnt, k - acc[cnt-1])
0