結果

問題 No.9 モンスターのレベル上げ
ユーザー assy1028assy1028
提出日時 2015-03-20 21:49:50
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 204 ms / 5,000 ms
コード長 1,136 bytes
コンパイル時間 582 ms
使用メモリ 5,160 KB
最終ジャッジ日時 2023-01-21 14:22:57
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
4,900 KB
testcase_01 AC 2 ms
4,908 KB
testcase_02 AC 204 ms
4,900 KB
testcase_03 AC 165 ms
5,156 KB
testcase_04 AC 86 ms
4,904 KB
testcase_05 AC 57 ms
4,900 KB
testcase_06 AC 20 ms
4,900 KB
testcase_07 AC 2 ms
4,904 KB
testcase_08 AC 26 ms
4,904 KB
testcase_09 AC 202 ms
5,160 KB
testcase_10 AC 2 ms
5,156 KB
testcase_11 AC 123 ms
4,900 KB
testcase_12 AC 110 ms
4,900 KB
testcase_13 AC 124 ms
4,904 KB
testcase_14 AC 202 ms
4,904 KB
testcase_15 AC 181 ms
4,908 KB
testcase_16 AC 4 ms
4,904 KB
testcase_17 AC 117 ms
5,152 KB
testcase_18 AC 97 ms
5,156 KB
testcase_19 AC 3 ms
4,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <complex>
#include <string.h>
using namespace std;

#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef pair<int, int> P;
typedef unsigned int uint;

const int inf = 1000000009;

int main() {
    int n;
    scanf("%d", &n);
    priority_queue<P, vector<P>, greater<P> > t_que;
    vector<int> bs(2*n);
    for (int i = 0; i < n; i++) {
	int a;
	scanf("%d", &a);
	t_que.push(P(a, 0));
    }    
    for (int i = 0; i < n; i++) {
	int b;
	scanf("%d", &b);
	bs[i] = bs[i+n] = b;
    }
    int res = inf;
    for (int i = 0; i < n; i++) {
	priority_queue<P, vector<P>, greater<P> > que = t_que;
	int maxi = 0;
	for (int j = i; j < i + n; j++) {
	    P p = que.top(); que.pop();
	    p.first += bs[j]/2;
	    p.second++;
	    maxi = max(maxi, p.second);
	    que.push(p);
	}
	res = min(res, maxi);
    }
    printf("%d\n", res);
}
0