結果

問題 No.9 モンスターのレベル上げ
ユーザー assy1028assy1028
提出日時 2015-03-20 21:49:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 204 ms / 5,000 ms
コード長 1,136 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 03:42:31
合計ジャッジ時間 3,384 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 204 ms
4,380 KB
testcase_03 AC 163 ms
4,380 KB
testcase_04 AC 85 ms
4,380 KB
testcase_05 AC 56 ms
4,376 KB
testcase_06 AC 20 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 27 ms
4,380 KB
testcase_09 AC 203 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 123 ms
4,380 KB
testcase_12 AC 110 ms
4,376 KB
testcase_13 AC 125 ms
4,376 KB
testcase_14 AC 203 ms
4,380 KB
testcase_15 AC 182 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 116 ms
4,380 KB
testcase_18 AC 95 ms
4,380 KB
testcase_19 AC 3 ms
4,384 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