結果

問題 No.2424 Josouzai
ユーザー Manuel1024
提出日時 2023-08-18 21:02:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 398 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 74,908 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 04:39:36
合計ジャッジ時間 3,916 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for(auto &it: a) cin >> it;
    sort(a.begin(), a.end());
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i] < k){
            ans++;
            k -= a[i];
        }else break;
    }
    cout << ans << " " << k << endl;
    return 0;
}
0