結果

問題 No.9 モンスターのレベル上げ
ユーザー rogi52rogi52
提出日時 2022-08-18 01:17:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 490 ms / 5,000 ms
コード長 808 bytes
コンパイル時間 2,625 ms
コンパイル使用メモリ 201,904 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 12:25:34
合計ジャッジ時間 7,220 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 490 ms
6,944 KB
testcase_03 AC 390 ms
6,940 KB
testcase_04 AC 203 ms
6,940 KB
testcase_05 AC 132 ms
6,940 KB
testcase_06 AC 45 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 60 ms
6,940 KB
testcase_09 AC 478 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 394 ms
6,940 KB
testcase_12 AC 325 ms
6,940 KB
testcase_13 AC 232 ms
6,944 KB
testcase_14 AC 476 ms
6,940 KB
testcase_15 AC 437 ms
6,940 KB
testcase_16 AC 8 ms
6,940 KB
testcase_17 AC 278 ms
6,944 KB
testcase_18 AC 231 ms
6,940 KB
testcase_19 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N; cin >> N;
    vector<int> A(N), B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];

    int ans = 1e9;
    rep(s,N) {
        priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
        rep(i,N) pq.push({A[i], 0});
        rep(i,N) {
            pair<int,int> x = pq.top(); pq.pop();
            x.first += B[(s + i) % N] / 2;
            x.second++;
            pq.push(x);
        }
        int cur = 0;
        rep(i,N) {
            pair<int,int> x = pq.top(); pq.pop();
            cur = max(cur, x.second);
        }
        ans = min(ans, cur);
    }
    cout << ans << endl;
}
0