結果

問題 No.9 モンスターのレベル上げ
ユーザー yaoshimax
提出日時 2015-02-09 18:06:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 725 ms
コンパイル使用メモリ 93,148 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 16:31:32
合計ジャッジ時間 3,729 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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