結果

問題 No.9 モンスターのレベル上げ
ユーザー kk
提出日時 2021-02-25 21:20:22
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 243 ms / 5,000 ms
コード長 760 bytes
コンパイル時間 2,029 ms
使用メモリ 3,592 KB
最終ジャッジ日時 2022-11-25 00:48:05
合計ジャッジ時間 5,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,460 KB
testcase_01 AC 1 ms
3,432 KB
testcase_02 AC 243 ms
3,580 KB
testcase_03 AC 179 ms
3,544 KB
testcase_04 AC 92 ms
3,424 KB
testcase_05 AC 60 ms
3,424 KB
testcase_06 AC 20 ms
3,564 KB
testcase_07 AC 2 ms
3,400 KB
testcase_08 AC 28 ms
3,488 KB
testcase_09 AC 216 ms
3,504 KB
testcase_10 AC 2 ms
3,516 KB
testcase_11 AC 165 ms
3,548 KB
testcase_12 AC 144 ms
3,492 KB
testcase_13 AC 110 ms
3,592 KB
testcase_14 AC 219 ms
3,440 KB
testcase_15 AC 201 ms
3,540 KB
testcase_16 AC 4 ms
3,512 KB
testcase_17 AC 127 ms
3,500 KB
testcase_18 AC 106 ms
3,484 KB
testcase_19 AC 3 ms
3,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const int INF = 1<<20;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];

  int ret = INF;
  for (int k = 0; k < n; k++) {
    priority_queue<tuple<int, int>, vector<tuple<int, int>>, greater<tuple<int, int>> > q;
    for (int i = 0; i < n; i++)
      q.emplace(a[i], 0);

    int tmp = 0;
    for (int i = 0; i < n; i++) {
      int j = (k + i) % n;
      int lv, cnt;
      tie(lv, cnt) = q.top();
      q.pop();
      ++cnt;
      tmp = max(tmp, cnt);
      q.emplace(lv + b[j] / 2, cnt);
    }

    ret = min(ret, tmp);
  }
  cout << ret << endl;
  
  return 0;
}
0