結果

問題 No.9 モンスターのレベル上げ
ユーザー recososorecososo
提出日時 2020-02-28 18:32:48
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 277 ms / 5,000 ms
コード長 721 bytes
コンパイル時間 1,475 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2022-12-07 08:16:56
合計ジャッジ時間 5,187 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
4,900 KB
testcase_01 AC 1 ms
6,952 KB
testcase_02 AC 277 ms
6,952 KB
testcase_03 AC 220 ms
4,904 KB
testcase_04 AC 116 ms
4,904 KB
testcase_05 AC 77 ms
4,900 KB
testcase_06 AC 27 ms
6,948 KB
testcase_07 AC 2 ms
6,948 KB
testcase_08 AC 35 ms
4,908 KB
testcase_09 AC 272 ms
4,904 KB
testcase_10 AC 1 ms
4,908 KB
testcase_11 AC 200 ms
4,900 KB
testcase_12 AC 176 ms
4,900 KB
testcase_13 AC 142 ms
4,904 KB
testcase_14 AC 274 ms
4,904 KB
testcase_15 AC 245 ms
4,904 KB
testcase_16 AC 5 ms
4,900 KB
testcase_17 AC 158 ms
4,900 KB
testcase_18 AC 132 ms
4,904 KB
testcase_19 AC 4 ms
4,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin >> n;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    int ans=1e5;
    for(int i=0;i<n;i++){
        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
        for(int j=0;j<n;j++){
            pq.push({a[j],0});
        }
        int t=0;
        for(int j=0;j<n;j++){
            int u=pq.top().first,v=pq.top().second;
            pq.pop();
            u+=b[(i+j)%n]/2;
            v++;
            pq.push({u,v});
            t=max(t,v);
        }
        if(t<=ans){
            ans=t;
        }
    }
    cout << ans << endl;
}
0