結果

問題 No.9 モンスターのレベル上げ
ユーザー TomorrowNextTomorrowNext
提出日時 2021-04-09 01:25:13
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 500 ms / 5,000 ms
コード長 1,077 bytes
コンパイル時間 1,587 ms
使用メモリ 3,612 KB
最終ジャッジ日時 2023-01-21 22:20:01
合計ジャッジ時間 7,430 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,536 KB
testcase_01 AC 1 ms
3,452 KB
testcase_02 AC 500 ms
3,508 KB
testcase_03 AC 404 ms
3,580 KB
testcase_04 AC 211 ms
3,556 KB
testcase_05 AC 137 ms
3,404 KB
testcase_06 AC 47 ms
3,516 KB
testcase_07 AC 2 ms
3,504 KB
testcase_08 AC 62 ms
3,564 KB
testcase_09 AC 485 ms
3,556 KB
testcase_10 AC 2 ms
3,528 KB
testcase_11 AC 419 ms
3,432 KB
testcase_12 AC 354 ms
3,596 KB
testcase_13 AC 342 ms
3,612 KB
testcase_14 AC 487 ms
3,584 KB
testcase_15 AC 444 ms
3,552 KB
testcase_16 AC 8 ms
3,480 KB
testcase_17 AC 285 ms
3,432 KB
testcase_18 AC 239 ms
3,576 KB
testcase_19 AC 5 ms
3,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;
using ll = long long;

void Main() {
    int N;
    cin >> N;
    vector<int> A(N, 0), B(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < N; ++i) {
        cin >> B[i];
    }

    typedef pair<pair<int, int>, int> level_nb_id;
    int ans = N;
    for (int i = 0; i < N; ++i) {
        priority_queue<level_nb_id, vector<level_nb_id>, greater<level_nb_id>> q;
        for (int j = 0; j < N; ++j) {
            q.push(make_pair(make_pair(A[j], 0), j));
        }
        for (int j = 0; j < N; ++j) {
            level_nb_id curr = q.top();
            q.pop();
            curr.first.first += B[(i + j) % N] / 2;
            curr.first.second += 1;
            q.push(curr);
        }
        int temp = 0;
        for (int j = 0; j < N; ++j) {
            temp = max(temp, q.top().first.second);
            q.pop();
        }
        ans = min(ans, temp);
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}
0