結果

問題 No.9 モンスターのレベル上げ
ユーザー rodearodea
提出日時 2019-09-16 16:28:40
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 494 ms / 5,000 ms
コード長 1,751 bytes
コンパイル時間 1,065 ms
使用メモリ 3,628 KB
最終ジャッジ日時 2023-02-10 02:54:05
合計ジャッジ時間 6,925 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,488 KB
testcase_01 AC 1 ms
3,516 KB
testcase_02 AC 494 ms
3,440 KB
testcase_03 AC 390 ms
3,628 KB
testcase_04 AC 205 ms
3,424 KB
testcase_05 AC 133 ms
3,548 KB
testcase_06 AC 44 ms
3,476 KB
testcase_07 AC 2 ms
3,536 KB
testcase_08 AC 60 ms
3,608 KB
testcase_09 AC 474 ms
3,584 KB
testcase_10 AC 1 ms
3,396 KB
testcase_11 AC 407 ms
3,612 KB
testcase_12 AC 310 ms
3,588 KB
testcase_13 AC 197 ms
3,584 KB
testcase_14 AC 475 ms
3,440 KB
testcase_15 AC 434 ms
3,572 KB
testcase_16 AC 7 ms
3,592 KB
testcase_17 AC 277 ms
3,504 KB
testcase_18 AC 233 ms
3,584 KB
testcase_19 AC 5 ms
3,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    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 = inf;
    for(int i=0; i<n; i++){
        priority_queue<P, vector<P>, greater<P>> que;
        for(int j=0; j<n; j++) que.emplace(a[j], 0);

        for(int j=i; j<i+n; j++){
            int level, cnt;
            tie(level, cnt) = que.top(); que.pop();

            level += b[j%n] / 2;
            cnt++;
            que.emplace(level, cnt);
        }

        int sum = 0;
        for(int j=0; j<n; j++){
            int level, cnt;
            tie(level, cnt) = que.top(); que.pop();
            chmax(sum, cnt);
        }

        chmin(ans, sum);
    }

    cout << ans << endl;

    return 0;
}
0