結果

問題 No.9 モンスターのレベル上げ
ユーザー SSRSSSRS
提出日時 2020-11-07 22:27:48
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 438 ms / 5,000 ms
コード長 790 bytes
コンパイル時間 2,301 ms
使用メモリ 9,772 KB
最終ジャッジ日時 2023-02-22 12:53:18
合計ジャッジ時間 6,628 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
7,688 KB
testcase_01 AC 1 ms
7,584 KB
testcase_02 AC 438 ms
7,608 KB
testcase_03 AC 350 ms
9,684 KB
testcase_04 AC 183 ms
7,572 KB
testcase_05 AC 120 ms
7,720 KB
testcase_06 AC 41 ms
7,568 KB
testcase_07 AC 2 ms
7,676 KB
testcase_08 AC 54 ms
7,572 KB
testcase_09 AC 431 ms
7,652 KB
testcase_10 AC 1 ms
7,592 KB
testcase_11 AC 363 ms
7,608 KB
testcase_12 AC 298 ms
7,580 KB
testcase_13 AC 219 ms
9,700 KB
testcase_14 AC 432 ms
7,668 KB
testcase_15 AC 388 ms
7,656 KB
testcase_16 AC 7 ms
9,772 KB
testcase_17 AC 251 ms
7,580 KB
testcase_18 AC 208 ms
7,652 KB
testcase_19 AC 5 ms
9,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int INF = 100000;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<int> B(N);
  for (int i = 0; i < N; i++){
    cin >> B[i];
  }
  int ans = INF;
  for (int i = 0; i < N; i++){
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    for (int j = 0; j < N; j++){
      pq.push(make_pair(A[j], 0));
    }
    for (int j = 0; j < N; j++){
      int l = pq.top().first;
      int t = pq.top().second;
      pq.pop();
      pq.push(make_pair(l + B[(i + j) % N] / 2, t + 1));
    }
    int mx = 0;
    for (int j = 0; j < N; j++){
      mx = max(mx, pq.top().second);
      pq.pop();
    }
    ans = min(ans, mx);
  }
  cout << ans << endl;
}
0