結果

問題 No.9 モンスターのレベル上げ
ユーザー ttakanottakano
提出日時 2017-12-04 20:25:43
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 393 ms / 5,000 ms
コード長 964 bytes
コンパイル時間 1,146 ms
使用メモリ 5,160 KB
最終ジャッジ日時 2023-01-21 16:54:25
合計ジャッジ時間 5,651 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
5,156 KB
testcase_01 AC 2 ms
5,156 KB
testcase_02 AC 393 ms
4,904 KB
testcase_03 AC 316 ms
4,900 KB
testcase_04 AC 164 ms
5,160 KB
testcase_05 AC 107 ms
4,904 KB
testcase_06 AC 37 ms
4,904 KB
testcase_07 AC 2 ms
4,904 KB
testcase_08 AC 49 ms
5,156 KB
testcase_09 AC 383 ms
4,900 KB
testcase_10 AC 1 ms
4,904 KB
testcase_11 AC 307 ms
4,904 KB
testcase_12 AC 241 ms
5,156 KB
testcase_13 AC 189 ms
4,904 KB
testcase_14 AC 383 ms
4,904 KB
testcase_15 AC 348 ms
5,152 KB
testcase_16 AC 7 ms
4,900 KB
testcase_17 AC 222 ms
4,900 KB
testcase_18 AC 185 ms
4,904 KB
testcase_19 AC 4 ms
5,160 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