結果

問題 No.9 モンスターのレベル上げ
ユーザー kk
提出日時 2021-02-25 21:20:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 274 ms / 5,000 ms
コード長 760 bytes
コンパイル時間 2,544 ms
コンパイル使用メモリ 208,516 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-24 17:40:48
合計ジャッジ時間 5,622 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 274 ms
4,376 KB
testcase_03 AC 218 ms
4,376 KB
testcase_04 AC 114 ms
4,380 KB
testcase_05 AC 74 ms
4,380 KB
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 35 ms
4,376 KB
testcase_09 AC 272 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 225 ms
4,376 KB
testcase_12 AC 153 ms
4,384 KB
testcase_13 AC 130 ms
4,376 KB
testcase_14 AC 274 ms
4,376 KB
testcase_15 AC 240 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 161 ms
4,380 KB
testcase_18 AC 131 ms
4,376 KB
testcase_19 AC 4 ms
4,376 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