結果

問題 No.9 モンスターのレベル上げ
ユーザー ei1333333ei1333333
提出日時 2018-11-21 22:39:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 248 ms / 5,000 ms
コード長 668 bytes
コンパイル時間 2,677 ms
コンパイル使用メモリ 204,492 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 02:41:42
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 241 ms
4,380 KB
testcase_03 AC 196 ms
4,380 KB
testcase_04 AC 103 ms
4,380 KB
testcase_05 AC 67 ms
4,376 KB
testcase_06 AC 24 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 31 ms
4,380 KB
testcase_09 AC 245 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 182 ms
4,376 KB
testcase_12 AC 164 ms
4,376 KB
testcase_13 AC 149 ms
4,376 KB
testcase_14 AC 248 ms
4,376 KB
testcase_15 AC 219 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 143 ms
4,380 KB
testcase_18 AC 117 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const int INF = 1 << 30;

using pi = pair< int, int >;

int main() {
  int N, A[1500], B[1500];
  cin >> 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 i = 0; i < N; i++) {
    priority_queue< pi, vector< pi >, greater<> > que;
    for(int j = 0; j < N; j++) que.emplace(A[j], 0);
    int res = 0;
    for(int j = 0; j < N; j++) {
      auto p = que.top();
      que.pop();
      res = max(res, p.second + 1);
      que.emplace(p.first + B[(i + j) % N] / 2, p.second + 1);
    }
    ret = min(ret, res);
  }
  cout << ret << endl;
}
0