結果

問題 No.9 モンスターのレベル上げ
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-05-04 14:58:55
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 289 ms / 5,000 ms
コード長 1,130 bytes
コンパイル時間 1,442 ms
使用メモリ 3,584 KB
最終ジャッジ日時 2023-01-21 15:36:21
合計ジャッジ時間 5,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,412 KB
testcase_01 AC 2 ms
3,428 KB
testcase_02 AC 289 ms
3,508 KB
testcase_03 AC 230 ms
3,580 KB
testcase_04 AC 120 ms
3,432 KB
testcase_05 AC 79 ms
3,556 KB
testcase_06 AC 27 ms
3,488 KB
testcase_07 AC 2 ms
3,460 KB
testcase_08 AC 36 ms
3,484 KB
testcase_09 AC 283 ms
3,544 KB
testcase_10 AC 2 ms
3,496 KB
testcase_11 AC 227 ms
3,556 KB
testcase_12 AC 213 ms
3,532 KB
testcase_13 AC 167 ms
3,508 KB
testcase_14 AC 284 ms
3,476 KB
testcase_15 AC 256 ms
3,584 KB
testcase_16 AC 6 ms
3,404 KB
testcase_17 AC 163 ms
3,524 KB
testcase_18 AC 137 ms
3,464 KB
testcase_19 AC 4 ms
3,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef vector<vector<int>> VV;

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int N;
    cin >> N;
    V a(N);
    rep(i, N) cin >> a[i];
    V b(N);
    rep(i, N) cin >> b[i];

    // 先頭を全通り試す
    int ans = 99999999;
    rep(head, N) {
        priority_queue<P, vector<P>, greater<P>> que;   // レベル、戦闘回数
        rep(i, N) que.push(P(a[i], 0));
        int ma = 0; // 最大の戦闘回数
        rep(i, N) {
            auto mine = que.top(); que.pop();
            mine.first += b[(head + i) % N] / 2;
            mine.second++;
            ma = max(ma, mine.second);
            que.push(mine);
        }
        ans = min(ans, ma);
    }

    cout << ans << endl;

}
0