結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2025-07-11 09:28:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 4,066 ms |
コンパイル使用メモリ | 280,212 KB |
実行使用メモリ | 7,972 KB |
最終ジャッジ日時 | 2025-07-11 09:28:45 |
合計ジャッジ時間 | 4,888 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG // []で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意 #endif #include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; using ll = long long; using Graph = vector<vector<int>>; ll INF = 2e18 + 1; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int ans=0,L, n; vector<int> W; cin >> L >> n; for (int i = 0; i < n; i++){ int w; cin >> w; W.push_back(w); } sort(W.begin(), W.end()); for (int i = 0; i < n; i++){ L -= W[i]; if(L>0) ans++; else break; } cout << ans << endl; }