結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー 37kt_
提出日時 2015-10-28 11:51:39
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 189 ms / 5,000 ms
コード長 652 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,185 ms
コンパイル使用メモリ 186,004 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-09 06:36:34
合計ジャッジ時間 3,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

typedef pair<int, int> P;

int n;
int a[1500], b[3000];

int calc(int a[], int b[])
{
	priority_queue<P, vector<P>, greater<P>> pq;
	for (int i = 0; i < n; i++){
		pq.push(P(a[i], 0));
	}

	int res = 0;
	for (int i = 0; i < n; i++){
		int lv, ct;
		tie(lv, ct) = pq.top(); pq.pop();
		pq.push(P(lv + b[i] / 2, ct + 1));
		res = max(res, ct + 1);
	}

	return res;
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i], b[i + n] = b[i];
	
	int res = 1 << 28;
	for (int i = 0; i < n; i++){
		res = min(res, calc(a, b + i));
	}

	cout << res << endl;
}
0