結果

問題 No.9 モンスターのレベル上げ
ユーザー masamasa
提出日時 2015-01-19 04:35:15
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 200 ms / 5,000 ms
コード長 781 bytes
コンパイル時間 496 ms
使用メモリ 3,592 KB
最終ジャッジ日時 2023-01-21 13:59:09
合計ジャッジ時間 3,242 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,504 KB
testcase_01 AC 1 ms
3,520 KB
testcase_02 AC 200 ms
3,592 KB
testcase_03 AC 155 ms
3,480 KB
testcase_04 AC 82 ms
3,552 KB
testcase_05 AC 55 ms
3,492 KB
testcase_06 AC 20 ms
3,500 KB
testcase_07 AC 1 ms
3,440 KB
testcase_08 AC 25 ms
3,540 KB
testcase_09 AC 197 ms
3,564 KB
testcase_10 AC 1 ms
3,532 KB
testcase_11 AC 123 ms
3,460 KB
testcase_12 AC 87 ms
3,480 KB
testcase_13 AC 111 ms
3,464 KB
testcase_14 AC 198 ms
3,480 KB
testcase_15 AC 178 ms
3,572 KB
testcase_16 AC 5 ms
3,428 KB
testcase_17 AC 113 ms
3,464 KB
testcase_18 AC 94 ms
3,412 KB
testcase_19 AC 3 ms
3,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;
const int devide = 10000;

int main() {
	int n, a, b;
	cin >> n;

	priority_queue<long, vector<long>, greater<long> > pque_input;
	vector<int> enemy;

	for (int i = 0; i < n; i++) {
		cin >> a;
		pque_input.push(a * devide);
	}
	for (int i = 0; i < n; i++) {
		cin >> b;
		enemy.push_back(b);
	}

	long ans = 1e9;
	for (int i = 0; i < n; i++) {
		long battles = 0;
		auto pque = pque_input;
		for (int j = 0; j < n; j++) {
			long tmp = pque.top();
			pque.pop();
			tmp += (long)enemy[(i + j) % n] / 2 * devide + 1;
			pque.push(tmp);
			battles = max(battles, tmp % devide);
		}
		ans = min(ans, battles);
	}
	cout << ans << endl;
	return 0;
}
0