結果

問題 No.9 モンスターのレベル上げ
ユーザー Ricky_ponRicky_pon
提出日時 2020-05-18 12:00:21
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 265 ms / 5,000 ms
コード長 1,454 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 201,768 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-09 21:27:12
合計ジャッジ時間 5,137 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 259 ms
6,944 KB
testcase_03 AC 204 ms
6,940 KB
testcase_04 AC 106 ms
6,944 KB
testcase_05 AC 69 ms
6,944 KB
testcase_06 AC 24 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 32 ms
6,940 KB
testcase_09 AC 253 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 193 ms
6,940 KB
testcase_12 AC 171 ms
6,940 KB
testcase_13 AC 167 ms
6,940 KB
testcase_14 AC 265 ms
6,940 KB
testcase_15 AC 231 ms
6,944 KB
testcase_16 AC 5 ms
6,944 KB
testcase_17 AC 149 ms
6,944 KB
testcase_18 AC 120 ms
6,944 KB
testcase_19 AC 4 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int n;
    scanf("%d", &n);
    int a[n], b[n];
    rep(i, n) scanf("%d", &a[i]);
    rep(i, n) scanf("%d", &b[i]);
    int ans = MAX;
    rep(start, n){
        priority_queue<pii, vector<pii>, greater<>> que;
        rep(i, n) que.emplace(a[i], 0);
        int cnt = 0;
        for(int i=start, t=0; t<n; i=(i+1)%n, ++t){
            auto p = que.top();
            que.pop();
            p.fi += b[i] / 2;
            ++p.se;
            chmax(cnt, p.se);
            que.push(p);
        }
        chmin(ans, cnt);
    }
    printf("%d\n", ans);
}
0