結果

問題 No.9 モンスターのレベル上げ
ユーザー tai96tai96
提出日時 2015-02-22 16:10:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 429 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 74,140 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 03:39:06
合計ジャッジ時間 5,336 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 429 ms
4,380 KB
testcase_03 AC 341 ms
4,376 KB
testcase_04 AC 177 ms
4,376 KB
testcase_05 AC 116 ms
4,376 KB
testcase_06 AC 40 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 54 ms
4,380 KB
testcase_09 AC 416 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 351 ms
4,380 KB
testcase_12 AC 281 ms
4,376 KB
testcase_13 AC 202 ms
4,376 KB
testcase_14 AC 422 ms
4,376 KB
testcase_15 AC 381 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 239 ms
4,376 KB
testcase_18 AC 205 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <functional>
#include <algorithm>

typedef std::pair<int, int> P; //Lv,cnt
typedef std::priority_queue< P, std::vector<P>, std::greater<P> > Q;

int n;
int a[1501], b[1501];
int ans = 100000000;

int main(){
	std::cin >> n;
	for (int i = 0; i < n; i++)std::cin >> a[i];
	for (int i = 0; i < n; i++)std::cin >> b[i];

	for (int i = 0; i < n; i++){
		Q que;
		for (int j = 0; j < n; j++)que.push(P(a[j], 0));

		for (int j = 0; j < n; j++){
			int t = (i + j) % n;

			P p = que.top();
			que.pop();

			p.first += b[t] / 2;
			p.second++;

			que.push(p);
		}

		int max = 0;
		for (int i = 0; i < n; i++){
			P p = que.top();
			que.pop();
			max = std::max(max, p.second);
		}

		ans = std::min(ans, max);
	}

	std::cout << ans << std::endl;

	return 0;
}
0