結果

問題 No.9 モンスターのレベル上げ
ユーザー yaoshimaxyaoshimax
提出日時 2015-02-09 18:06:08
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 91,668 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 21:08:51
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 264 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 72 ms
4,376 KB
testcase_06 AC 25 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 33 ms
4,380 KB
testcase_09 AC 259 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 199 ms
4,376 KB
testcase_12 AC 179 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 261 ms
4,376 KB
testcase_15 AC 235 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 126 ms
4,376 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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