結果

問題 No.9 モンスターのレベル上げ
ユーザー 👑 NachiaNachia
提出日時 2020-09-27 12:38:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 415 ms / 5,000 ms
コード長 729 bytes
コンパイル時間 1,545 ms
コンパイル使用メモリ 170,100 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 01:10:37
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 415 ms
4,376 KB
testcase_03 AC 333 ms
4,376 KB
testcase_04 AC 173 ms
4,376 KB
testcase_05 AC 113 ms
4,376 KB
testcase_06 AC 39 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 51 ms
4,384 KB
testcase_09 AC 405 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 334 ms
4,376 KB
testcase_12 AC 276 ms
4,376 KB
testcase_13 AC 191 ms
4,380 KB
testcase_14 AC 406 ms
4,376 KB
testcase_15 AC 367 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 236 ms
4,380 KB
testcase_18 AC 197 ms
4,376 KB
testcase_19 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
int A[1500];
int B[3000];

int main() {
    cin >> N;
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i]; rep(i, N) B[i + N] = B[i] = B[i] / 2;

    int ans = N;
    rep(s, N) {
        priority_queue<pair<int, int>> Q;
        rep(i, N) Q.push({ -A[i], 0 });
        rep(i, N) {
            auto p = Q.top(); Q.pop();
            p.second--;
            p.first -= B[s + i];
            Q.push(p);
        }
        int tmp = 0;
        while (Q.size()) { tmp = max(tmp, -Q.top().second); Q.pop(); }
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}
0