結果
問題 |
No.156 キャンディー・ボックス
|
ユーザー |
![]() |
提出日時 | 2019-01-08 01:06:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 646 ms |
コンパイル使用メモリ | 74,544 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 16:23:47 |
合計ジャッジ時間 | 1,402 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define repeat(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() typedef long long int64; int main() { int64 n, m; cin >> n >> m; vector<int64> C(n); repeat(i, n) { cin >> C[i]; } sort(all(C)); int64 ans = 0; repeat(i, n) { m -= C[i]; ans += m >= 0 ? 1 : 0; } cout << ans << endl; }