結果

問題 No.9 モンスターのレベル上げ
ユーザー opqopq_opqopq_
提出日時 2015-05-11 17:15:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 833 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 46,540 KB
実行使用メモリ 5,316 KB
最終ジャッジ日時 2023-09-20 02:40:39
合計ジャッジ時間 4,529 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,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
4,376 KB
testcase_11 AC 285 ms
4,376 KB
testcase_12 AC 294 ms
4,380 KB
testcase_13 AC 224 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <queue>
using namespace std;

#define N_MAX 1500

struct State {
	int level, turn;
	State(int l) : level(l), turn(0) {}
	bool operator < (const State& r) const {
		if (level != r.level) return level > r.level;
		return turn > r.turn;
	}
};

int N;
int A[N_MAX], B[N_MAX];

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", A + i);
	for (int i = 0; i < N; i++) scanf("%d", B + i);
	
	int res = 0;
	
	priority_queue<State> pq;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) pq.push(A[j]);
		int j = i, cnt = 0;
		while (cnt != N) {
			State s = pq.top();
			pq.pop();
			s.level += B[j] / 2;
			s.turn++;
			pq.push(s);
			j = (j + 1) % N;
			cnt++;
		}
		while (!pq.empty()) {
			res = max(res, pq.top().turn);
			pq.pop();
		}
	}
	
	printf("%d\n", res);
	
	return 0;
}

0