結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
suibaka_ku
|
| 提出日時 | 2017-03-08 10:34:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 507 bytes |
| コンパイル時間 | 639 ms |
| コンパイル使用メモリ | 85,136 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 16:00:02 |
| 合計ジャッジ時間 | 2,020 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr ll M = 1e9+7;
int main() {
int N, M;
cin >> N >> M;
vector<int> C(N);
for(int i=0; i<N; ++i) {
cin >> C[i];
}
sort(C.begin(), C.end());
for(int i=0; i<N; ++i) {
M -= C[i];
if(M <= 0) {
cout << i+(M == 0) << endl;
return 0;
}
}
cout << N << endl;
}
suibaka_ku