結果

問題 No.9 モンスターのレベル上げ
ユーザー hogeover30hogeover30
提出日時 2015-02-12 20:48:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 210 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 72,112 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:37:15
合計ジャッジ時間 3,236 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 209 ms
4,380 KB
testcase_03 AC 172 ms
4,376 KB
testcase_04 AC 89 ms
4,380 KB
testcase_05 AC 60 ms
4,380 KB
testcase_06 AC 22 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 27 ms
4,376 KB
testcase_09 AC 210 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 132 ms
4,380 KB
testcase_12 AC 119 ms
4,376 KB
testcase_13 AC 138 ms
4,376 KB
testcase_14 AC 210 ms
4,376 KB
testcase_15 AC 189 ms
4,376 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 121 ms
4,376 KB
testcase_18 AC 102 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
    int n;
    while (cin>>n) {
        vector<int> b(n);
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> a;
        for(int i=0;i<n;++i) {
            int t; cin>>t;
            a.emplace(t, 0);
        }
        for(int& v: b) cin>>v;

        int res=1000000;
        for(int k=0;k<n;++k) {
            auto s=a;
            int cnt=0;
            for(int i=0;i<n;++i) {
                auto x=s.top();
                s.pop();
                x.first+=b[(i+k)%n]/2;
                x.second++;
                cnt=max(cnt, x.second);
                s.push(x);
            }
            res=min(res, cnt);
        }
        cout<<res<<endl;
    }
}
0