結果

問題 No.5 数字のブロック
ユーザー fuu32
提出日時 2017-10-29 14:09:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 1,807 ms
コンパイル使用メモリ 171,780 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-22 05:10:39
合計ジャッジ時間 2,761 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define UB upper_bound
#define LB lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int l,n;
  cin>>l>>n;
  vector<int> w(n);
  REP(i,n)cin>>w[i];
  sort(ALL(w));
  int ans=0;
  REP(i,n){
    if(l-w[i]>0){
      ans++;
      l-=w[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}
0