結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
Kurichan0806
|
| 提出日時 | 2017-12-05 17:37:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 566 bytes |
| コンパイル時間 | 726 ms |
| コンパイル使用メモリ | 88,144 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 16:09:10 |
| 合計ジャッジ時間 | 1,608 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
#include <functional>
using namespace std;
#define diff(x,y) ((x > y) ? (x - y) : (y - x))
#define us(x) (x > 0) ? x : x * -1
#define lli long long int
int main() {
int n, m, ans = 0;
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 < m; i++) {
if (C[ans] == 0){
ans++;
i--;
continue;
}
C[ans]--;
}
if (C[ans] == 0) ans++;
cout << ans << endl;
return 0;
}
Kurichan0806