結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2014-12-05 01:48:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 789 ms |
コンパイル使用メモリ | 91,540 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 22:07:36 |
合計ジャッジ時間 | 1,797 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <numeric> #include <cctype> #include <tuple> #include <climits> #include <bitset> #include <cassert> #include <random> #ifdef _MSC_VER #include <agents.h> #endif #define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i) #define rep(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define REV(v) v.rbegin(), v.rend() #define MEMSET(v, s) memset(v, s, sizeof(v)) #define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end()) #define MP make_pair #define MT make_tuple using namespace std; typedef long long ll; typedef pair<int, int> P; int main(){ cin.tie(0); ios::sync_with_stdio(false); int L, N; cin >> L >> N; vector<int> w(N); rep(i, N) cin >> w[i]; sort(ALL(w)); rep(i, N - 1) w[i + 1] += w[i]; for (int i = N; i >= 1; --i){ if (w[i - 1] <= L){ cout << i << endl; break; } } return 0; }