結果

問題 No.2424 Josouzai
ユーザー lam6er
提出日時 2025-03-20 18:40:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,824 KB
実行使用メモリ 114,648 KB
最終ジャッジ日時 2025-03-20 18:40:20
合計ジャッジ時間 4,599 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

prefix = [0]
for num in A:
    prefix.append(prefix[-1] + num)

max_plots = bisect.bisect_right(prefix, K) - 1
remaining_chemical = K - prefix[max_plots]

print(max_plots, remaining_chemical)
0