結果

問題 No.9 モンスターのレベル上げ
ユーザー face4face4
提出日時 2018-09-06 16:40:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 847 bytes
コンパイル時間 1,877 ms
コンパイル使用メモリ 75,600 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-14 11:23:30
合計ジャッジ時間 6,485 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 363 ms
4,380 KB
testcase_03 AC 294 ms
4,380 KB
testcase_04 AC 157 ms
4,380 KB
testcase_05 AC 100 ms
4,376 KB
testcase_06 AC 34 ms
4,500 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 45 ms
4,376 KB
testcase_09 AC 357 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 298 ms
4,380 KB
testcase_12 AC 234 ms
4,380 KB
testcase_13 AC 174 ms
4,376 KB
testcase_14 AC 358 ms
4,380 KB
testcase_15 AC 324 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 208 ms
4,376 KB
testcase_18 AC 173 ms
4,384 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<queue>
using namespace std;

int main(){
    int n;
    cin >> n;

    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 = 10001;

    for(int i = 0; i < n; i++){
        priority_queue<pair<int,int>> pq;
        for(int j = 0; j < n; j++)  pq.push(make_pair(-a[j], 0));

        for(int j = 0; j < n; j++){
            int encount = b[(i+j)%n];
            pair<int,int> monster = pq.top(); pq.pop();
            monster.first -= encount/2;
            monster.second--;
            pq.push(monster);
        }

        int tmpmax = 0;
        while(!pq.empty()){
            pair<int,int> p = pq.top(); pq.pop();
            tmpmax = max(tmpmax, -p.second);
        }
        ans = min(ans, tmpmax);
    }

    cout << ans << endl;

    return 0;
}
0