結果
| 問題 |
No.2424 Josouzai
|
| コンテスト | |
| ユーザー |
Manuel1024
|
| 提出日時 | 2023-08-18 21:03:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 844 ms |
| コンパイル使用メモリ | 74,540 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 04:42:25 |
| 合計ジャッジ時間 | 3,594 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
#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;
}
Manuel1024