結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2015-04-15 02:36:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 399 bytes |
| コンパイル時間 | 474 ms |
| コンパイル使用メモリ | 59,224 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 14:34:02 |
| 合計ジャッジ時間 | 1,454 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | AC * 7 WA * 23 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
int main() {
int N, M; cin >> N >> M;
int C[N];
rep(i, N) cin >> C[i];
sort(C, C+N);
for(int i=0; i<N; i++) {
M-=C[i];
if(M < 0) {
cout << N-i << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
moti