結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-02 11:41:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 346 bytes |
| コンパイル時間 | 1,978 ms |
| コンパイル使用メモリ | 198,524 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-02 11:41:07 |
| 合計ジャッジ時間 | 3,359 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N,M; cin >> N >> M;
vector<int> A(N);
for(auto &a : A) cin >> a;
sort(A.begin(),A.end());
int answer = 0;
for(auto a : A){
if(M >= a) answer++,M -= a;
}
cout << answer << endl;
}