結果

問題 No.9 モンスターのレベル上げ
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-08 00:28:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 879 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 67,572 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 15:23:10
合計ジャッジ時間 4,835 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 402 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 36 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 48 ms
5,376 KB
testcase_09 AC 389 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 363 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 247 ms
5,376 KB
testcase_14 AC 403 ms
5,376 KB
testcase_15 AC 353 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 228 ms
5,376 KB
testcase_18 AC 195 ms
5,376 KB
testcase_19 AC 4 ms
5,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 = a[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