結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2022-10-17 17:04:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 804 bytes |
| コンパイル時間 | 1,759 ms |
| コンパイル使用メモリ | 170,492 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 07:19:23 |
| 合計ジャッジ時間 | 2,710 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
#if 1 && defined(LOCAL)
#include <LOCAL/LOCAL.hpp>
#else
#define debug(...)
#define line
#endif
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
int main() {
int L,N;
cin>>L>>N;
priority_queue<int,vector<int>,greater<int>>A;
for(int i=0;i<N;i++){
int a;
cin>>a;
A.push(a);
}
for(int i=0;i<N;i++){
L-=A.top();
A.pop();
if(L<0){
cout<<i<<endl;
return 0;
}
}
cout<<N<<endl;
}