結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 202 ms
4,376 KB
testcase_03 AC 153 ms
4,376 KB
testcase_04 AC 83 ms
4,380 KB
testcase_05 AC 55 ms
4,380 KB
testcase_06 AC 20 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 25 ms
4,376 KB
testcase_09 AC 193 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 121 ms
4,376 KB
testcase_12 AC 87 ms
4,380 KB
testcase_13 AC 109 ms
4,376 KB
testcase_14 AC 197 ms
4,380 KB
testcase_15 AC 177 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 110 ms
4,376 KB
testcase_18 AC 91 ms
4,376 KB
testcase_19 AC 3 ms
4,380 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