結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2024-10-01 20:05:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 482 bytes |
コンパイル時間 | 3,033 ms |
コンパイル使用メモリ | 252,384 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 20:05:29 |
合計ジャッジ時間 | 4,154 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for(long long i = 0; i < n; i++)#define ALL(v) (v).begin(), (v).end()using namespace std;using lint = long long;int main() {lint l;int n;cin >> l >> n;vector<lint> w(n);rep(i, n) {cin >> w[i];}sort(ALL(w));vector<lint> s(n + 1);for (int i = 1; i <= n; i++) {s[i] = s[i - 1] + w[i - 1];}int id = lower_bound(ALL(s), l) - s.begin();cout << id - 1 << endl;}