結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2022-10-02 22:11:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 1,974 ms |
コンパイル使用メモリ | 197,864 KB |
最終ジャッジ日時 | 2025-02-07 20:42:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 14 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;using vi = vector<int>;using vl = vector<long long>;using vc = vector<char>;using vs = vector<string>;using vb = vector<bool>;using Graph = vector<vector<int>>;#define _GLIBCXX_DEBUG#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define ALL(f,c,... ) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))const int INF = 1e9;const int MININF = -1e9;const ll LINF = 1e18;const int MOD = 1e9+7;const int MODD = 998244353;int main(){int L,N; cin>>L>>N;vi W(N);rep(i,N)cin>>W[i];ALL(sort,W);int ans=0;for(int i=0;i<N;i++){ans+=W[i];if(ans>=L){cout<<i<<endl;return 0;}}}