結果

問題 No.9 モンスターのレベル上げ
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-05-04 14:58:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 318 ms / 5,000 ms
コード長 1,130 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 172,452 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:36:32
合計ジャッジ時間 5,412 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 318 ms
4,376 KB
testcase_03 AC 254 ms
4,376 KB
testcase_04 AC 134 ms
4,380 KB
testcase_05 AC 89 ms
4,380 KB
testcase_06 AC 31 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 41 ms
4,380 KB
testcase_09 AC 316 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 263 ms
4,380 KB
testcase_12 AC 219 ms
4,376 KB
testcase_13 AC 213 ms
4,380 KB
testcase_14 AC 318 ms
4,376 KB
testcase_15 AC 285 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 187 ms
4,376 KB
testcase_18 AC 153 ms
4,376 KB
testcase_19 AC 4 ms
4,376 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