結果

問題 No.9 モンスターのレベル上げ
ユーザー face4face4
提出日時 2018-09-06 16:40:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 393 ms / 5,000 ms
コード長 847 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 75,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 23:40:58
合計ジャッジ時間 4,897 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 383 ms
5,376 KB
testcase_03 AC 299 ms
5,376 KB
testcase_04 AC 166 ms
5,376 KB
testcase_05 AC 105 ms
5,376 KB
testcase_06 AC 37 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 47 ms
5,376 KB
testcase_09 AC 376 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 312 ms
5,376 KB
testcase_12 AC 246 ms
5,376 KB
testcase_13 AC 192 ms
5,376 KB
testcase_14 AC 393 ms
5,376 KB
testcase_15 AC 356 ms
5,376 KB
testcase_16 AC 6 ms
5,376 KB
testcase_17 AC 225 ms
5,376 KB
testcase_18 AC 187 ms
5,376 KB
testcase_19 AC 5 ms
5,376 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