結果

問題 No.2424 Josouzai
ユーザー sotanishysotanishy
提出日時 2023-08-18 21:22:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 195 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 103,296 KB
最終ジャッジ日時 2023-08-18 21:22:22
合計ジャッジ時間 7,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,080 KB
testcase_01 AC 74 ms
71,204 KB
testcase_02 AC 74 ms
71,140 KB
testcase_03 AC 71 ms
70,956 KB
testcase_04 AC 95 ms
84,292 KB
testcase_05 AC 165 ms
101,192 KB
testcase_06 AC 152 ms
101,216 KB
testcase_07 AC 152 ms
101,652 KB
testcase_08 AC 154 ms
101,040 KB
testcase_09 AC 69 ms
70,960 KB
testcase_10 AC 83 ms
83,524 KB
testcase_11 AC 106 ms
103,296 KB
testcase_12 AC 98 ms
96,656 KB
testcase_13 AC 93 ms
84,096 KB
testcase_14 AC 111 ms
93,248 KB
testcase_15 AC 76 ms
76,064 KB
testcase_16 AC 143 ms
99,400 KB
testcase_17 AC 88 ms
80,912 KB
testcase_18 AC 92 ms
82,876 KB
testcase_19 AC 105 ms
90,672 KB
testcase_20 AC 159 ms
99,620 KB
testcase_21 AC 122 ms
98,216 KB
testcase_22 AC 92 ms
83,932 KB
testcase_23 AC 97 ms
86,944 KB
testcase_24 AC 83 ms
79,152 KB
testcase_25 AC 149 ms
101,776 KB
testcase_26 AC 122 ms
98,368 KB
testcase_27 AC 154 ms
100,336 KB
testcase_28 AC 134 ms
101,608 KB
testcase_29 AC 145 ms
101,648 KB
testcase_30 AC 86 ms
79,176 KB
testcase_31 AC 110 ms
88,844 KB
testcase_32 AC 151 ms
101,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
s = 0
cnt = 0
for x in A:
    if s + x <= K:
        s += x
        cnt += 1
    else:
        break
print(cnt, K-s)
0