結果

問題 No.2424 Josouzai
ユーザー Yoshitada IkedaYoshitada Ikeda
提出日時 2023-10-01 10:13:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2023-10-01 10:14:08
合計ジャッジ時間 7,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,720 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 15 ms
7,876 KB
testcase_04 AC 47 ms
14,872 KB
testcase_05 AC 129 ms
29,776 KB
testcase_06 AC 130 ms
29,692 KB
testcase_07 AC 130 ms
29,744 KB
testcase_08 AC 130 ms
29,824 KB
testcase_09 AC 15 ms
7,896 KB
testcase_10 AC 36 ms
14,644 KB
testcase_11 AC 72 ms
27,680 KB
testcase_12 AC 58 ms
22,472 KB
testcase_13 AC 47 ms
14,696 KB
testcase_14 AC 73 ms
19,844 KB
testcase_15 AC 23 ms
9,604 KB
testcase_16 AC 114 ms
27,048 KB
testcase_17 AC 39 ms
12,892 KB
testcase_18 AC 43 ms
13,660 KB
testcase_19 AC 65 ms
18,100 KB
testcase_20 AC 117 ms
28,132 KB
testcase_21 AC 89 ms
22,468 KB
testcase_22 AC 46 ms
14,308 KB
testcase_23 AC 54 ms
15,840 KB
testcase_24 AC 32 ms
11,240 KB
testcase_25 AC 119 ms
28,492 KB
testcase_26 AC 89 ms
22,624 KB
testcase_27 AC 127 ms
29,252 KB
testcase_28 AC 109 ms
27,408 KB
testcase_29 AC 99 ms
24,004 KB
testcase_30 AC 33 ms
11,772 KB
testcase_31 AC 61 ms
17,304 KB
testcase_32 AC 119 ms
29,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
aList = list(map(int, input().split()))

aList.sort()

sum = 0
nmax = 0
for i in range(n):
    if sum + aList[i] > k:
        break
    else:
        sum = sum + aList[i]
        nmax = nmax + 1

rest = k - sum

print("%d %d" % (nmax, rest))
0