結果

問題 No.9 モンスターのレベル上げ
ユーザー ei1333333ei1333333
提出日時 2015-04-05 12:36:49
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,566 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 150,956 KB
実行使用メモリ 11,832 KB
最終ジャッジ日時 2023-09-17 04:32:44
合計ジャッジ時間 13,640 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
 
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is >> a.first >> a.second; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os << a.first << " "<<a.second; }
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) is >> vc[i]; return is; }
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) os << vc[i] << endl; return os; }
 
#define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)
#define ALL(v) (v).begin(), (v).end()
#define UNQ(s) { sort(ALL(s)); (s).erase( unique( ALL(s)), (s).end());}
#define fr first
#define sc second
 
typedef pair< int , int > Pi;
typedef pair< int , Pi > Pii;
 
typedef long long int64;
const int INF = 1 << 30;

int main(){
  int N;
  cin >> N;
  vector< int > A(N), B(N);
  cin >> A;
  cin >> B;

  int ret = INF;

  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  for(int i = 0; i < N; i++){ /* 最初に戦うモンスター */
    for(int j = 0; j < N; j++) que.push( Pi( A[j], 0));

    int res = 0;
    int cnt = 0;
    while(!que.empty()) {
      int pos = (i + cnt) % N;

      Pi p = que.top(); que.pop(); /* 一番低いモンスター */
      int next_Cost = p.first + B[pos] / 2;
      res = max( res, p.second + 1); 
      que.push( Pi( next_Cost, p.second + 1));
      ++cnt;
    }
    ret = min( ret, res);
  }
  cout << ret << endl;
}
0