結果

問題 No.2424 Josouzai
ユーザー 0214sh70214sh7
提出日時 2023-08-17 20:00:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 205,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 03:46:58
合計ジャッジ時間 4,277 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 25 ms
5,376 KB
testcase_05 AC 85 ms
5,376 KB
testcase_06 AC 79 ms
5,376 KB
testcase_07 AC 79 ms
5,376 KB
testcase_08 AC 86 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 20 ms
5,376 KB
testcase_11 AC 57 ms
5,376 KB
testcase_12 AC 42 ms
5,376 KB
testcase_13 AC 25 ms
5,376 KB
testcase_14 AC 46 ms
5,376 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 73 ms
5,376 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 23 ms
5,376 KB
testcase_19 AC 40 ms
5,376 KB
testcase_20 AC 73 ms
5,376 KB
testcase_21 AC 57 ms
5,376 KB
testcase_22 AC 26 ms
5,376 KB
testcase_23 AC 31 ms
5,376 KB
testcase_24 AC 15 ms
5,376 KB
testcase_25 AC 78 ms
5,376 KB
testcase_26 AC 56 ms
5,376 KB
testcase_27 AC 84 ms
5,376 KB
testcase_28 AC 70 ms
5,376 KB
testcase_29 AC 64 ms
5,376 KB
testcase_30 AC 16 ms
5,376 KB
testcase_31 AC 37 ms
5,376 KB
testcase_32 AC 83 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;

int main(void){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);
    
    long long N,K;
    cin >> N >> K;
    vector<long long> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    sort(A.begin(),A.end());
    long long 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