結果

問題 No.9 モンスターのレベル上げ
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-08-19 09:50:08
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 217 ms / 5,000 ms
コード長 951 bytes
コンパイル時間 569 ms
使用メモリ 3,724 KB
最終ジャッジ日時 2023-01-21 16:03:50
合計ジャッジ時間 3,550 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,564 KB
testcase_01 AC 1 ms
3,596 KB
testcase_02 AC 217 ms
3,604 KB
testcase_03 AC 174 ms
3,724 KB
testcase_04 AC 91 ms
3,584 KB
testcase_05 AC 60 ms
3,644 KB
testcase_06 AC 21 ms
3,576 KB
testcase_07 AC 1 ms
3,604 KB
testcase_08 AC 28 ms
3,580 KB
testcase_09 AC 212 ms
3,724 KB
testcase_10 AC 1 ms
3,564 KB
testcase_11 AC 132 ms
3,668 KB
testcase_12 AC 120 ms
3,672 KB
testcase_13 AC 132 ms
3,596 KB
testcase_14 AC 213 ms
3,684 KB
testcase_15 AC 193 ms
3,600 KB
testcase_16 AC 4 ms
3,572 KB
testcase_17 AC 123 ms
3,680 KB
testcase_18 AC 103 ms
3,624 KB
testcase_19 AC 3 ms
3,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)

using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;

int main() {
	int n;
	scanf("%d", &n);
	priority_queue<pii, vector<pii>, greater<pii>> a;
	vector<int> b(n);
	REP(i, n) {
		int x;
		scanf("%d", &x);
		a.push({ x,0 });
	}
	REP(i, n) scanf("%d", &b[i]);
	int ans = 1501;
	REP(i, n) {
		priority_queue<pii, vector<pii>, greater<pii>> party = a;
		int Max = 0;
		for(int j = 0; n > j; j++) {
			int num = (i + j)%n;
			pii cur = party.top();
			cur = { cur.first + (b[num] / 2), cur.second + 1 };
			Max = max(Max, cur.second);
			party.pop();
			party.push(cur);
		}
		ans = min(ans, Max);
	}
	printf("%d\n", ans);
	return 0;
}
0