結果

問題 No.9 モンスターのレベル上げ
ユーザー ttakanottakano
提出日時 2017-12-04 20:25:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 393 ms / 5,000 ms
コード長 964 bytes
コンパイル時間 1,368 ms
コンパイル使用メモリ 150,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:35:55
合計ジャッジ時間 5,677 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 393 ms
4,376 KB
testcase_03 AC 315 ms
4,380 KB
testcase_04 AC 163 ms
4,380 KB
testcase_05 AC 107 ms
4,376 KB
testcase_06 AC 37 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 48 ms
4,380 KB
testcase_09 AC 381 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 307 ms
4,376 KB
testcase_12 AC 241 ms
4,380 KB
testcase_13 AC 189 ms
4,376 KB
testcase_14 AC 388 ms
4,380 KB
testcase_15 AC 348 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 223 ms
4,380 KB
testcase_18 AC 185 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
  int n;
  cin>>n;
  int a[1502];
  int b[1502];
  priority_queue<PI, vector<PI>, greater<PI> > pque;
  REP(i,n){
    cin>>a[i];
    pque.push(make_pair(a[i],0));
  }
  REP(i,n)cin>>b[i];
  int min_=mod;
  REP(i,n){
    int max_=(-1)*mod;
    auto cp=pque;
    REP(j,n){
      int enemy=(i+j)%n;
      PI now=cp.top();
      cp.pop();
      now.first+=b[enemy]/2;
      now.second++;
      cp.push(make_pair(now.first,now.second));
    }
    while(!cp.empty()){
      PI s=cp.top();
      cp.pop();
      max_=max(max_,s.second);
    }
    min_=min(min_,max_);
  }
  print(min_);
}
0