結果

問題 No.2424 Josouzai
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 21:12:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 102,668 KB
最終ジャッジ日時 2023-08-18 21:12:16
合計ジャッジ時間 5,927 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,088 KB
testcase_01 AC 72 ms
71,400 KB
testcase_02 AC 75 ms
71,328 KB
testcase_03 AC 72 ms
71,236 KB
testcase_04 AC 98 ms
84,120 KB
testcase_05 AC 161 ms
101,832 KB
testcase_06 AC 159 ms
101,428 KB
testcase_07 AC 161 ms
101,504 KB
testcase_08 AC 159 ms
101,692 KB
testcase_09 AC 72 ms
71,272 KB
testcase_10 AC 86 ms
83,668 KB
testcase_11 AC 109 ms
102,668 KB
testcase_12 AC 101 ms
96,240 KB
testcase_13 AC 96 ms
84,088 KB
testcase_14 AC 113 ms
92,836 KB
testcase_15 AC 80 ms
76,484 KB
testcase_16 AC 146 ms
98,064 KB
testcase_17 AC 92 ms
81,244 KB
testcase_18 AC 93 ms
83,100 KB
testcase_19 AC 108 ms
90,516 KB
testcase_20 AC 149 ms
98,520 KB
testcase_21 AC 125 ms
97,872 KB
testcase_22 AC 96 ms
84,076 KB
testcase_23 AC 102 ms
87,076 KB
testcase_24 AC 85 ms
79,576 KB
testcase_25 AC 154 ms
100,648 KB
testcase_26 AC 125 ms
97,668 KB
testcase_27 AC 156 ms
101,016 KB
testcase_28 AC 137 ms
100,260 KB
testcase_29 AC 132 ms
100,640 KB
testcase_30 AC 91 ms
79,400 KB
testcase_31 AC 107 ms
88,892 KB
testcase_32 AC 155 ms
101,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

ある数が代表になるためには

・それより右に小さい数が無い

が必須

"""

import sys
from sys import stdin

N,K = map(int,input().split())

A = list(map(int,stdin.readline().split()))

A.sort()

ans = 0
for i in range(N):

    if A[i] <= K:
        K -= A[i]
        ans += 1

print (ans,K)
0