結果

問題 No.9 モンスターのレベル上げ
ユーザー ant2357ant2357
提出日時 2017-08-02 23:55:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,096 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 203,808 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-19 13:37:27
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 117 ms
5,376 KB
testcase_12 AC 84 ms
5,376 KB
testcase_13 AC 107 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;

int solve(int n, vector<int> a, vector<int> b, priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> partyInfo) {
	int res = 0;
	for (int i = 0; i < n; i++) {
		int fightNumMax = 0;
		
		priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq = partyInfo;
		for (int j = 0; j < n; j++) {
			int now = (i + j < n ? i + j : i + j - n);

			pair<int, int> player = pq.top(); pq.pop();
			player.first += b[now] / 2;
			player.second++;

			fightNumMax = max(fightNumMax, player.second);
			pq.push(player);
		}
		res = max(res, fightNumMax);
	}

	return res;
}

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

	int n;
	cin >> n;

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> partyInfo;
	for (int i = 0; i < n; i++) {
		partyInfo.push(make_pair(a[i], 0));
	}

	cout << solve(n, a, b, partyInfo) << endl;
	return 0;
}
0