結果

問題 No.9 モンスターのレベル上げ
ユーザー xuzijian629xuzijian629
提出日時 2018-11-02 01:08:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 385 ms / 5,000 ms
コード長 1,067 bytes
コンパイル時間 2,778 ms
コンパイル使用メモリ 208,936 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-12 19:56:01
合計ジャッジ時間 7,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 385 ms
4,380 KB
testcase_03 AC 304 ms
4,380 KB
testcase_04 AC 162 ms
4,384 KB
testcase_05 AC 105 ms
4,380 KB
testcase_06 AC 38 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 49 ms
4,380 KB
testcase_09 AC 365 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 308 ms
4,380 KB
testcase_12 AC 240 ms
4,380 KB
testcase_13 AC 175 ms
4,384 KB
testcase_14 AC 379 ms
4,380 KB
testcase_15 AC 337 ms
4,380 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 221 ms
4,384 KB
testcase_18 AC 184 ms
4,384 KB
testcase_19 AC 4 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    // assert(freopen("/Users/xuzijian/yukicoder/input4", "r", stdin));
    int n;
    cin >> n;
    using ii = pair<int, int>;
    priority_queue<ii, vector<ii>, greater<ii>> que;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        que.push(ii(a, 0));
    }

    deque<int> bs;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        bs.push_back(b);
    }

    int ans = 1e9;
    for (int i = 0; i < n; i++) {
        priority_queue<ii, vector<ii>, greater<ii>> q(que);
        for (int j = 0; j < n; j++) {
            ii m = q.top();
            q.pop();
            m.first += bs[j] / 2;
            m.second++;
            q.push(m);
        }
        int tmp = -1;
        while (q.size()) {
            tmp = max(tmp, q.top().second);
            q.pop();
        }
        ans = min(ans, tmp);
        bs.push_back(bs.front());
        bs.pop_front();
    }   
    cout << ans << endl;
}
0