結果

問題 No.9 モンスターのレベル上げ
ユーザー tai96tai96
提出日時 2015-02-22 16:10:25
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 434 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 484 ms
使用メモリ 5,160 KB
最終ジャッジ日時 2023-01-21 14:18:01
合計ジャッジ時間 5,367 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
4,904 KB
testcase_01 AC 1 ms
4,904 KB
testcase_02 AC 434 ms
5,160 KB
testcase_03 AC 348 ms
4,908 KB
testcase_04 AC 182 ms
5,152 KB
testcase_05 AC 119 ms
5,152 KB
testcase_06 AC 40 ms
4,900 KB
testcase_07 AC 2 ms
4,900 KB
testcase_08 AC 54 ms
4,904 KB
testcase_09 AC 423 ms
4,904 KB
testcase_10 AC 2 ms
4,900 KB
testcase_11 AC 357 ms
4,900 KB
testcase_12 AC 288 ms
4,904 KB
testcase_13 AC 204 ms
4,900 KB
testcase_14 AC 425 ms
5,152 KB
testcase_15 AC 384 ms
4,900 KB
testcase_16 AC 7 ms
4,904 KB
testcase_17 AC 247 ms
5,152 KB
testcase_18 AC 205 ms
4,904 KB
testcase_19 AC 5 ms
5,156 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