結果

問題 No.2424 Josouzai
ユーザー CecilCecil
提出日時 2023-08-18 21:05:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 213 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,640 KB
最終ジャッジ日時 2024-05-06 02:34:13
合計ジャッジ時間 4,309 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,624 KB
testcase_01 AC 25 ms
10,624 KB
testcase_02 AC 26 ms
10,496 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 58 ms
17,228 KB
testcase_05 AC 136 ms
32,512 KB
testcase_06 AC 135 ms
32,492 KB
testcase_07 AC 137 ms
32,360 KB
testcase_08 AC 144 ms
32,640 KB
testcase_09 AC 26 ms
10,624 KB
testcase_10 AC 45 ms
16,380 KB
testcase_11 AC 80 ms
27,516 KB
testcase_12 AC 65 ms
23,200 KB
testcase_13 AC 55 ms
17,448 KB
testcase_14 AC 81 ms
22,576 KB
testcase_15 AC 33 ms
12,288 KB
testcase_16 AC 118 ms
29,928 KB
testcase_17 AC 50 ms
15,572 KB
testcase_18 AC 51 ms
16,564 KB
testcase_19 AC 72 ms
20,704 KB
testcase_20 AC 120 ms
30,512 KB
testcase_21 AC 95 ms
25,672 KB
testcase_22 AC 57 ms
17,064 KB
testcase_23 AC 65 ms
18,704 KB
testcase_24 AC 40 ms
14,040 KB
testcase_25 AC 125 ms
31,364 KB
testcase_26 AC 97 ms
25,340 KB
testcase_27 AC 132 ms
32,096 KB
testcase_28 AC 115 ms
29,040 KB
testcase_29 AC 105 ms
27,276 KB
testcase_30 AC 43 ms
14,344 KB
testcase_31 AC 70 ms
20,284 KB
testcase_32 AC 130 ms
31,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
ans = 0
while i < n:
    if k - a[i] >= 0:
        k -= a[i]
        i += 1
        ans += 1
    else:
        break
print(ans, k)
0