結果

問題 No.9 モンスターのレベル上げ
ユーザー rogi52rogi52
提出日時 2022-08-18 01:17:12
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 430 ms / 5,000 ms
コード長 808 bytes
コンパイル時間 1,934 ms
使用メモリ 3,592 KB
最終ジャッジ日時 2022-11-28 11:14:51
合計ジャッジ時間 6,900 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,392 KB
testcase_01 AC 1 ms
3,388 KB
testcase_02 AC 430 ms
3,548 KB
testcase_03 AC 345 ms
3,576 KB
testcase_04 AC 180 ms
3,564 KB
testcase_05 AC 119 ms
3,504 KB
testcase_06 AC 41 ms
3,460 KB
testcase_07 AC 2 ms
3,408 KB
testcase_08 AC 54 ms
3,428 KB
testcase_09 AC 418 ms
3,436 KB
testcase_10 AC 1 ms
3,492 KB
testcase_11 AC 353 ms
3,436 KB
testcase_12 AC 303 ms
3,428 KB
testcase_13 AC 219 ms
3,440 KB
testcase_14 AC 423 ms
3,444 KB
testcase_15 AC 381 ms
3,592 KB
testcase_16 AC 7 ms
3,512 KB
testcase_17 AC 245 ms
3,440 KB
testcase_18 AC 205 ms
3,504 KB
testcase_19 AC 5 ms
3,396 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