結果

問題 No.2424 Josouzai
ユーザー hato336hato336
提出日時 2023-08-18 21:02:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 123,516 KB
最終ジャッジ日時 2024-05-06 02:27:33
合計ジャッジ時間 6,854 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
85,632 KB
testcase_01 AC 107 ms
85,716 KB
testcase_02 AC 111 ms
85,888 KB
testcase_03 AC 109 ms
85,632 KB
testcase_04 AC 146 ms
98,008 KB
testcase_05 AC 194 ms
123,516 KB
testcase_06 AC 197 ms
122,668 KB
testcase_07 AC 190 ms
122,896 KB
testcase_08 AC 194 ms
123,492 KB
testcase_09 AC 115 ms
85,712 KB
testcase_10 AC 129 ms
96,896 KB
testcase_11 AC 151 ms
116,520 KB
testcase_12 AC 141 ms
109,980 KB
testcase_13 AC 135 ms
97,780 KB
testcase_14 AC 160 ms
106,336 KB
testcase_15 AC 120 ms
89,728 KB
testcase_16 AC 185 ms
118,528 KB
testcase_17 AC 140 ms
94,152 KB
testcase_18 AC 143 ms
96,768 KB
testcase_19 AC 155 ms
104,136 KB
testcase_20 AC 190 ms
118,908 KB
testcase_21 AC 173 ms
111,696 KB
testcase_22 AC 136 ms
97,872 KB
testcase_23 AC 154 ms
100,520 KB
testcase_24 AC 128 ms
92,436 KB
testcase_25 AC 182 ms
122,320 KB
testcase_26 AC 166 ms
111,592 KB
testcase_27 AC 193 ms
122,380 KB
testcase_28 AC 181 ms
115,360 KB
testcase_29 AC 175 ms
114,732 KB
testcase_30 AC 137 ms
92,576 KB
testcase_31 AC 151 ms
102,288 KB
testcase_32 AC 198 ms
122,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#n = int(input())
#
#alist = []
#s = input()
n,k = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
alist = list(map(int,input().split()))
alist.append(10**18)
alist.sort()
temp = 0
ans = 0
for i in alist:
    if temp + i <= k:
        temp += i
        ans += 1
    else:
        print(ans,k-temp)
        break
0