結果

問題 No.9 モンスターのレベル上げ
ユーザー NotationNapNotationNap
提出日時 2015-04-22 04:26:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 444 ms / 5,000 ms
コード長 695 bytes
コンパイル時間 1,259 ms
コンパイル使用メモリ 150,712 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:44:35
合計ジャッジ時間 6,024 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 444 ms
4,380 KB
testcase_03 AC 359 ms
4,380 KB
testcase_04 AC 185 ms
4,376 KB
testcase_05 AC 123 ms
4,376 KB
testcase_06 AC 42 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 55 ms
4,376 KB
testcase_09 AC 437 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 374 ms
4,376 KB
testcase_12 AC 296 ms
4,376 KB
testcase_13 AC 208 ms
4,380 KB
testcase_14 AC 440 ms
4,380 KB
testcase_15 AC 398 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 257 ms
4,376 KB
testcase_18 AC 217 ms
4,380 KB
testcase_19 AC 5 ms
4,376 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