結果

問題 No.9 モンスターのレベル上げ
ユーザー mh72012246mh72012246
提出日時 2016-11-07 16:19:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 451 ms / 5,000 ms
コード長 1,374 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 81,032 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:01:05
合計ジャッジ時間 5,271 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 451 ms
4,380 KB
testcase_03 AC 343 ms
4,376 KB
testcase_04 AC 180 ms
4,380 KB
testcase_05 AC 118 ms
4,380 KB
testcase_06 AC 41 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 54 ms
4,376 KB
testcase_09 AC 413 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 353 ms
4,376 KB
testcase_12 AC 271 ms
4,380 KB
testcase_13 AC 215 ms
4,380 KB
testcase_14 AC 415 ms
4,380 KB
testcase_15 AC 379 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 241 ms
4,376 KB
testcase_18 AC 205 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <sstream>   // istringstream
#include <algorithm> // sort
#include <utility>   // pair
#include <cfloat>    // DBL_MAX

typedef long long ll;
using namespace std;

// const int maxN = 200000;
// bool ps[maxN-1];

int main(){
  ll N; // [1500]
  cin >> N;

  priority_queue<pair<int,int>,
                 vector<pair<int,int> >,
                 greater<pair<int,int> > > party;
  vector<int> monster(N);
  for(int i=0; i<N; i++){
    int tmp;
    cin >> tmp;
    party.push(make_pair(tmp,0));
  }
  for(int i=0; i<N; i++){
    cin >> monster[i];
  }

  // main
  int minmaxb = 2000; // > 1500
  // for from each monster begin,
  for(int i=0; i<N; i++){
    priority_queue<pair<int,int>,
                   vector<pair<int,int> >,
                   greater<pair<int,int> > > sim(party);
    // the result becomes,
    for(int j=0; j<N; j++){
      sim.push(make_pair(sim.top().first+monster[(i+j)%N]/2,
                         sim.top().second+1));
      sim.pop();
    }
    // max battle is,
    int maxb = 0;
    while(!sim.empty()){
      maxb = max(maxb, sim.top().second);
      //cout << sim.top().first<<" "<<sim.top().second<<",";
      sim.pop();
    }
    minmaxb = min(minmaxb, maxb);
  }

  cout << minmaxb << endl;

  return 0;
}
0