結果
問題 | No.2424 Josouzai |
ユーザー |
![]() |
提出日時 | 2023-08-18 21:02:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 2,880 ms |
コンパイル使用メモリ | 249,700 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 04:39:46 |
合計ジャッジ時間 | 5,086 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> namespace nono { void solve() { int n, k; std::cin >> n >> k; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } std::sort(a.begin(), a.end()); int ans = 0; for (int v: a) { if (v <= k) { k -= v; ans++; } } std::cout << ans << ' ' << k << std::endl; } } // namespace nono int main() { std::cin.tie(0)->sync_with_stdio(0); std::cout << std::fixed << std::setprecision(15); int t = 1; // std::cin >> t; while (t--) nono::solve(); }