結果

問題 No.9 モンスターのレベル上げ
ユーザー yaoshimaxyaoshimax
提出日時 2015-02-09 18:08:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 278 ms / 5,000 ms
コード長 978 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 92,256 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 03:37:12
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 278 ms
4,380 KB
testcase_03 AC 217 ms
4,376 KB
testcase_04 AC 111 ms
4,376 KB
testcase_05 AC 75 ms
4,376 KB
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 36 ms
4,380 KB
testcase_09 AC 268 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 208 ms
4,380 KB
testcase_12 AC 171 ms
4,376 KB
testcase_13 AC 140 ms
4,380 KB
testcase_14 AC 268 ms
4,376 KB
testcase_15 AC 246 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 157 ms
4,380 KB
testcase_18 AC 130 ms
4,384 KB
testcase_19 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  int B[N];
  for( int i = 0 ; i <N; i++ ) cin >> A[i];
  for( int i = 0 ; i <N; i++ ) cin >> B[i];
  int ans = INT_MAX;
  for( int i = 0 ; i <N; i++ ){
    int curAns = 0;
    priority_queue<pair<int,int> > q;
    for( int j = 0 ; j <N ; j++){
      q.push(make_pair(-A[j],0));
    }
    for( int j = 0 ; j <N; j++ ){
      int ind = (i+j)%N;
      pair<int,int> p = q.top();
      q.pop();
      q.push( make_pair(p.first-B[ind]/2,p.second-1));
      curAns = max(curAns,-p.second+1);
    }
    ans = min(ans,curAns);
  }
  cout << ans << endl;

  return 0;
}
0