結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー NotationNap
提出日時 2015-04-22 04:22:10
言語 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
結果
WA  
実行時間 -
コード長 769 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,732 ms
コンパイル使用メモリ 181,532 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-26 06:29:58
合計ジャッジ時間 5,178 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

typedef long long Int;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);++(i))

int A[1500];
int B[1500];
int main() {
	int N;
	cin >> N;
	REP(i, N) cin >> A[i];
	REP(i, N) cin >> B[i];

	int ans = 999999999;
	REP(i, N) {
		priority_queue<pair<int, int>> pq;
		REP(j, N) {
			if (i == j) {
				pq.push(make_pair(-(A[j] + B[0]/2), -1));
			}
			else {
				pq.push(make_pair(-A[j], 0));
			}
		}
		for (int j = 1; j < N; j++) {
			pair<int,int> top = pq.top();
			pq.pop();
			top.first -= B[j] / 2;
			top.second--;
			pq.push(top);
		}

		int maxButtle = 0;
		while (!pq.empty()) {
			int buttle = -pq.top().second;
			pq.pop();
			maxButtle = max(maxButtle, buttle);
		}
		ans = min(ans, maxButtle);
	}
	cout << ans << endl;
}
0