結果

問題 No.9 モンスターのレベル上げ
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-08 00:45:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 453 ms / 5,000 ms
コード長 879 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 68,784 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:00:15
合計ジャッジ時間 6,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 453 ms
4,380 KB
testcase_03 AC 362 ms
4,380 KB
testcase_04 AC 189 ms
4,376 KB
testcase_05 AC 123 ms
4,376 KB
testcase_06 AC 42 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 56 ms
4,376 KB
testcase_09 AC 439 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 370 ms
4,376 KB
testcase_12 AC 297 ms
4,380 KB
testcase_13 AC 212 ms
4,380 KB
testcase_14 AC 442 ms
4,380 KB
testcase_15 AC 401 ms
4,380 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 256 ms
4,380 KB
testcase_18 AC 214 ms
4,376 KB
testcase_19 AC 6 ms
4,376 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