結果
| 問題 | No.2424 Josouzai |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-11 18:31:06 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 1,420 ms |
| コンパイル使用メモリ | 215,380 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-02 00:15:14 |
| 合計ジャッジ時間 | 5,131 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using i64 = std::int64_t;
int main() {
int n;
i64 k;
std::cin >> n >> k;
std::vector<i64> a(n);
for (auto &x : a) std::cin >> x;
std::sort(a.begin(), a.end());
int ans = 0;
for (auto x : a) {
if (x <= k) {
k -= x;
ans++;
} else
break;
}
std::cout << ans << " " << k << '\n';
}