結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
stqn
|
| 提出日時 | 2014-11-25 19:42:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 587 bytes |
| コンパイル時間 | 1,066 ms |
| コンパイル使用メモリ | 161,532 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 22:03:27 |
| 合計ジャッジ時間 | 1,866 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define long int64_t
#define ulong uint64_t
const int N = 10000;
int l, n, w[N];
void input()
{
cin >> l >> n;
rep(i, n) cin >> w[i];
}
const int inf = int(1e9);
int s[N + 1];
int solve()
{
sort(w, w + n);
partial_sum(w, w + n, s);
s[n] = inf;
return upper_bound(s, s + n, l) - s;
}
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(false);
input();
cout << solve() << endl;
}
stqn