結果
問題 | No.2424 Josouzai |
ユーザー |
![]() |
提出日時 | 2023-08-18 23:11:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 2,009 ms |
コンパイル使用メモリ | 196,932 KB |
最終ジャッジ日時 | 2025-02-16 10:41:19 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; vector<int> a(n); for(int i = 0; i < n;i++) cin >> a[i]; sort(a.begin(), a.end()); int num = 0; int rem = k; for(int x: a){ if(rem >= x){ rem -= x; num++; } } cout << num << " " << rem; return 0; }