結果

問題 No.9 モンスターのレベル上げ
ユーザー femtofemto
提出日時 2016-09-22 20:58:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 448 ms / 5,000 ms
コード長 914 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 89,992 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:59:51
合計ジャッジ時間 5,692 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 448 ms
4,376 KB
testcase_03 AC 357 ms
4,380 KB
testcase_04 AC 187 ms
4,380 KB
testcase_05 AC 123 ms
4,376 KB
testcase_06 AC 41 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 55 ms
4,376 KB
testcase_09 AC 439 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 380 ms
4,380 KB
testcase_12 AC 304 ms
4,376 KB
testcase_13 AC 207 ms
4,376 KB
testcase_14 AC 435 ms
4,376 KB
testcase_15 AC 398 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 255 ms
4,380 KB
testcase_18 AC 213 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <functional>
#include <queue>
using namespace std;
typedef pair<int, int> Pii;

int A[1500];
int B[1500];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for(int i = 0; i < N; i++) {
		cin >> B[i];
	}

	int ans = 1 << 25;
	for(int s = 0; s < N; s++) {
		priority_queue < Pii, vector<Pii>, greater<Pii> > q;
		for(int i = 0; i < N; i++) {
			q.push(Pii(A[i], 0));
		}

		int m = s;
		for(int i = 0; i < N; i++) {
			Pii p = q.top();
			q.pop();
			p.first += B[m] / 2;
			p.second++;
			q.push(p);
			m = (m + 1) % N;
		}
		int max_c = 0;
		for(int i = 0; i < N; i++) {
			max_c = max(max_c, q.top().second);
			q.pop();
		}
		ans = min(ans, max_c);
	}

	cout << ans << endl;
}
0