結果

問題 No.733 分身並列コーディング
ユーザー cureskol
提出日時 2018-09-07 21:46:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 2,192 ms
コンパイル使用メモリ 163,160 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-29 12:24:50
合計ジャッジ時間 3,858 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 2 WA * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
  int T,N;
  cin>>T>>N;
  const int INF=1e7;
  std::vector<int> v(N);
  for(int i=0;i<N;i++)cin>>v[i];
  sort(v.rbegin(),v.rend());
  int ans=0;
  for(int i=0;i<N;i++){
    if(v[i]<INF){
      for(int j=i;j<N;j++){
        if(v[i]+v[j]<=T)v[i]+=v[j];
        v[j]=INF;
      }
      ans++;
    }
  }
  cout<<ans<<endl;
}
0