結果

問題 No.9 モンスターのレベル上げ
ユーザー KudeKude
提出日時 2020-09-03 08:19:06
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 298 ms / 5,000 ms
コード長 784 bytes
コンパイル時間 1,527 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2022-12-28 05:05:10
合計ジャッジ時間 5,394 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
4,904 KB
testcase_01 AC 1 ms
4,904 KB
testcase_02 AC 298 ms
4,900 KB
testcase_03 AC 236 ms
4,908 KB
testcase_04 AC 125 ms
4,900 KB
testcase_05 AC 81 ms
6,952 KB
testcase_06 AC 29 ms
4,904 KB
testcase_07 AC 2 ms
4,900 KB
testcase_08 AC 37 ms
4,904 KB
testcase_09 AC 295 ms
4,900 KB
testcase_10 AC 2 ms
4,900 KB
testcase_11 AC 229 ms
4,904 KB
testcase_12 AC 175 ms
4,904 KB
testcase_13 AC 155 ms
4,904 KB
testcase_14 AC 296 ms
6,952 KB
testcase_15 AC 264 ms
6,948 KB
testcase_16 AC 6 ms
4,904 KB
testcase_17 AC 172 ms
4,904 KB
testcase_18 AC 142 ms
4,900 KB
testcase_19 AC 4 ms
6,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
    int n;
    cin >> n;
    VI a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    int ans = n;
    rep(s, n) {
        priority_queue<P,vector<P>,greater<P>> q;
        rep(i, n) q.emplace(a[i],0);
        int mx = 0;
        rep(j, n) {
            int ai, ci;
            tie(ai, ci) = q.top(); q.pop();
            q.emplace(ai + b[(s+j)%n] / 2, ci + 1);
            chmax(mx, ci + 1);
        }
        chmin(ans, mx);
    }
    cout << ans << endl;
}
0