結果

問題 No.9 モンスターのレベル上げ
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-08 00:45:58
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 452 ms / 5,000 ms
コード長 879 bytes
コンパイル時間 459 ms
使用メモリ 3,680 KB
最終ジャッジ日時 2023-01-21 16:07:22
合計ジャッジ時間 5,438 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,596 KB
testcase_01 AC 1 ms
3,664 KB
testcase_02 AC 452 ms
3,612 KB
testcase_03 AC 360 ms
3,612 KB
testcase_04 AC 188 ms
3,592 KB
testcase_05 AC 122 ms
3,656 KB
testcase_06 AC 42 ms
3,572 KB
testcase_07 AC 2 ms
3,552 KB
testcase_08 AC 56 ms
3,564 KB
testcase_09 AC 439 ms
3,588 KB
testcase_10 AC 2 ms
3,612 KB
testcase_11 AC 367 ms
3,636 KB
testcase_12 AC 296 ms
3,644 KB
testcase_13 AC 207 ms
3,604 KB
testcase_14 AC 440 ms
3,608 KB
testcase_15 AC 401 ms
3,608 KB
testcase_16 AC 7 ms
3,572 KB
testcase_17 AC 256 ms
3,544 KB
testcase_18 AC 213 ms
3,680 KB
testcase_19 AC 5 ms
3,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;
int n;
int a[3010], b[3010];

int main(void){
	cin >> n;
	rep(i, n){
		cin >> a[i];
		a[i + n] = a[i];
	}
	rep(i, n){
		cin >> b[i];
		b[i + n] = b[i];
	}

	int ans = INF;
	rep(i, n){
		priority_queue<P, vector<P>, greater<P> > pq;
		for (int j = 0; j < n; ++j){
			pq.push(make_pair(a[j], 0));
		}


		for (int j = i; j < i + n; ++j){
			int nlv = pq.top().first;
			int t = pq.top().second;
			pq.pop();
			int lvup = b[j] / 2;
			pq.push(make_pair(nlv + lvup, t + 1));
		}
		int tmp = 0;
		while(!pq.empty()){
			int t = pq.top().second; pq.pop();
			tmp = max(tmp, t);
		}
		ans = min(ans, tmp);
	}
	printf("%d\n", ans);
	return 0;
}
0