結果
問題 | No.2424 Josouzai |
ユーザー |
![]() |
提出日時 | 2023-08-11 20:11:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 374 bytes |
コンパイル時間 | 1,806 ms |
コンパイル使用メモリ | 198,676 KB |
最終ジャッジ日時 | 2025-02-16 00:51:33 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; ll k; cin >> k; vector<ll> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(),a.end()); int ans = 0; for (int i = 0; i < n; i++){ if (a[i] > k) break; ans++; k -= a[i]; } cout << ans << " " << k << endl; }