結果

問題 No.9 モンスターのレベル上げ
ユーザー atn112323atn112323
提出日時 2016-05-03 18:40:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 280 ms / 5,000 ms
コード長 779 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 69,224 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 04:33:26
合計ジャッジ時間 4,132 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 280 ms
4,380 KB
testcase_03 AC 220 ms
4,376 KB
testcase_04 AC 117 ms
4,376 KB
testcase_05 AC 77 ms
4,376 KB
testcase_06 AC 27 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 35 ms
4,376 KB
testcase_09 AC 273 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 218 ms
4,384 KB
testcase_12 AC 176 ms
4,380 KB
testcase_13 AC 181 ms
4,376 KB
testcase_14 AC 273 ms
4,380 KB
testcase_15 AC 248 ms
4,380 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 AC 160 ms
4,380 KB
testcase_18 AC 135 ms
4,380 KB
testcase_19 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>

using namespace std;

int N;
int A[1500], AA[1500], B[1500];
int cnt[1500];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	int res = N;
	for (int i = 0; i < N; i++) {
		priority_queue<pair<int, int> > P;
		for (int j = 0; j < N; j++) {
			AA[j] = A[j];
			cnt[j] = 0;
			P.push(make_pair(-(AA[j] * N + cnt[j]), j));
		}
		for (int j = 0; j < N; j++) {
			int k = (i + j) % N;
			pair<int, int> p = P.top();
			P.pop();
			cnt[p.second]++;
			AA[p.second] += B[k] / 2;
			P.push(make_pair(-(AA[p.second] * N + cnt[p.second]), p.second));
		}
		res = min(res, *max_element(cnt, cnt + N));
	}
	cout << res << endl;
	return 0;
}
0