結果

問題 No.9 モンスターのレベル上げ
ユーザー recososorecososo
提出日時 2020-02-28 18:36:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 233 ms / 5,000 ms
コード長 713 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 167,668 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 17:38:57
合計ジャッジ時間 4,443 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 230 ms
6,940 KB
testcase_03 AC 177 ms
6,944 KB
testcase_04 AC 90 ms
6,944 KB
testcase_05 AC 63 ms
6,940 KB
testcase_06 AC 22 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 29 ms
6,940 KB
testcase_09 AC 230 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 164 ms
6,944 KB
testcase_12 AC 121 ms
6,944 KB
testcase_13 AC 122 ms
6,944 KB
testcase_14 AC 233 ms
6,944 KB
testcase_15 AC 209 ms
6,940 KB
testcase_16 AC 5 ms
6,940 KB
testcase_17 AC 129 ms
6,940 KB
testcase_18 AC 106 ms
6,944 KB
testcase_19 AC 4 ms
6,944 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;
    const int t=10000;
    for(int i=0;i<n;i++){
        priority_queue<int,vector<int>,greater<int>> pq;
        for(int j=0;j<n;j++){
            pq.push(a[j]*t);
        }
        int tmp=0;
        for(int j=0;j<n;j++){
            int u=pq.top()/t,v=pq.top()%t;
            pq.pop();
            u+=b[(i+j)%n]/2;
            v++;
            pq.push(u*t+v);
            tmp=max(tmp,v);
        }
        if(tmp<=ans){
            ans=tmp;
        }
    }
    cout << ans << endl;
}
0