結果

問題 No.9 モンスターのレベル上げ
ユーザー KudeKude
提出日時 2020-09-03 08:19:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 254 ms / 5,000 ms
コード長 784 bytes
コンパイル時間 1,439 ms
コンパイル使用メモリ 173,088 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 18:54:32
合計ジャッジ時間 4,840 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 254 ms
4,376 KB
testcase_03 AC 206 ms
4,376 KB
testcase_04 AC 108 ms
4,376 KB
testcase_05 AC 72 ms
4,376 KB
testcase_06 AC 25 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 34 ms
4,380 KB
testcase_09 AC 251 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 187 ms
4,380 KB
testcase_12 AC 146 ms
4,376 KB
testcase_13 AC 141 ms
4,380 KB
testcase_14 AC 247 ms
4,376 KB
testcase_15 AC 224 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 143 ms
4,376 KB
testcase_18 AC 123 ms
4,380 KB
testcase_19 AC 3 ms
4,376 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