結果

問題 No.9 モンスターのレベル上げ
ユーザー kkslucy1kkslucy1
提出日時 2018-04-03 23:16:02
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 453 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 1,561 ms
使用メモリ 3,584 KB
最終ジャッジ日時 2023-01-25 00:12:06
合計ジャッジ時間 6,418 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,376 KB
testcase_01 AC 1 ms
3,372 KB
testcase_02 AC 453 ms
3,584 KB
testcase_03 AC 360 ms
3,572 KB
testcase_04 AC 190 ms
3,500 KB
testcase_05 AC 124 ms
3,552 KB
testcase_06 AC 43 ms
3,536 KB
testcase_07 AC 2 ms
3,532 KB
testcase_08 AC 57 ms
3,392 KB
testcase_09 AC 444 ms
3,524 KB
testcase_10 AC 2 ms
3,528 KB
testcase_11 AC 385 ms
3,412 KB
testcase_12 AC 313 ms
3,480 KB
testcase_13 AC 217 ms
3,576 KB
testcase_14 AC 441 ms
3,536 KB
testcase_15 AC 403 ms
3,464 KB
testcase_16 AC 8 ms
3,500 KB
testcase_17 AC 257 ms
3,472 KB
testcase_18 AC 216 ms
3,568 KB
testcase_19 AC 5 ms
3,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	for (int i = 0;i < n;i++) {
		cin >> b[i];
	}

	int ans = 1000000000;
	for (int i = 0;i < n;i++) {
		priority_queue<pair<int, int>> q;
		for (int i = 0;i < n;i++) {
			q.push(make_pair(-a[i], 0));
		}
		for (int j = 0;j < n;j++) {
			int index = (i + j) % n;
			auto qt = q.top();q.pop();
			q.push(make_pair(qt.first - (b[index] / 2), qt.second - 1));
		}
		int ma = -1;
		for (int j = 0;j < n;j++) {
			auto qt = q.top();q.pop();
			ma = max(ma, -qt.second);
		}
		ans = min(ans, ma);
	}
	cout << ans << endl;







	return 0;
}
0