結果
問題 | No.2424 Josouzai |
ユーザー | ebi_fly |
提出日時 | 2023-08-11 18:31:06 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 2,209 ms |
コンパイル使用メモリ | 205,052 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 21:09:20 |
合計ジャッジ時間 | 4,989 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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'; }