結果

問題 No.9 モンスターのレベル上げ
ユーザー NotationNapNotationNap
提出日時 2015-04-22 04:26:24
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 457 ms / 5,000 ms
コード長 695 bytes
コンパイル時間 1,134 ms
使用メモリ 3,588 KB
最終ジャッジ日時 2023-01-21 14:26:16
合計ジャッジ時間 6,231 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,500 KB
testcase_01 AC 1 ms
3,528 KB
testcase_02 AC 457 ms
3,572 KB
testcase_03 AC 363 ms
3,536 KB
testcase_04 AC 192 ms
3,460 KB
testcase_05 AC 126 ms
3,516 KB
testcase_06 AC 44 ms
3,540 KB
testcase_07 AC 2 ms
3,444 KB
testcase_08 AC 58 ms
3,516 KB
testcase_09 AC 444 ms
3,480 KB
testcase_10 AC 1 ms
3,500 KB
testcase_11 AC 384 ms
3,480 KB
testcase_12 AC 304 ms
3,532 KB
testcase_13 AC 211 ms
3,572 KB
testcase_14 AC 447 ms
3,532 KB
testcase_15 AC 407 ms
3,564 KB
testcase_16 AC 7 ms
3,480 KB
testcase_17 AC 260 ms
3,588 KB
testcase_18 AC 219 ms
3,484 KB
testcase_19 AC 5 ms
3,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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) {
			pq.push(make_pair(-A[j], 0));
		}
		for (int j = 0; j < N; j++) {
			pair<int,int> top = pq.top();
			pq.pop();
			top.first -= B[(i + j) % N] / 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