結果
問題 | No.2424 Josouzai |
ユーザー |
![]() |
提出日時 | 2023-09-27 00:56:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 334 bytes |
コンパイル時間 | 1,814 ms |
コンパイル使用メモリ | 171,080 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 18:35:44 |
合計ジャッジ時間 | 4,630 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, K, ans;cin >> N >> K;vector<int> a( N );for( int i = 0; i < N; i++ ) cin >> a[i];sort( a.begin(), a.end() );ans = N;for( int i = 0; i < N; i++ ) {K -= a[i];if( K < 0 ) {ans = i;K += a[i];break;}}cout << ans << " " << K << endl;}