結果

問題 No.9 モンスターのレベル上げ
ユーザー SSRSSSRS
提出日時 2020-11-07 22:27:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 438 ms / 5,000 ms
コード長 790 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 171,216 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 20:58:52
合計ジャッジ時間 6,302 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 438 ms
4,376 KB
testcase_03 AC 351 ms
4,376 KB
testcase_04 AC 184 ms
4,380 KB
testcase_05 AC 118 ms
4,376 KB
testcase_06 AC 38 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 52 ms
4,380 KB
testcase_09 AC 412 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 344 ms
4,384 KB
testcase_12 AC 290 ms
4,376 KB
testcase_13 AC 197 ms
4,376 KB
testcase_14 AC 409 ms
4,380 KB
testcase_15 AC 370 ms
4,376 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 250 ms
4,380 KB
testcase_18 AC 206 ms
4,380 KB
testcase_19 AC 5 ms
4,376 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