結果

問題 No.9 モンスターのレベル上げ
ユーザー たこしたこし
提出日時 2015-06-07 23:59:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 410 ms / 5,000 ms
コード長 1,460 bytes
コンパイル時間 1,648 ms
コンパイル使用メモリ 95,388 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:48:52
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 410 ms
4,380 KB
testcase_03 AC 317 ms
4,376 KB
testcase_04 AC 169 ms
4,380 KB
testcase_05 AC 109 ms
4,376 KB
testcase_06 AC 38 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 50 ms
4,380 KB
testcase_09 AC 401 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 327 ms
4,380 KB
testcase_12 AC 255 ms
4,380 KB
testcase_13 AC 164 ms
4,380 KB
testcase_14 AC 401 ms
4,376 KB
testcase_15 AC 363 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 237 ms
4,380 KB
testcase_18 AC 194 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long

using namespace std;

#define MAX_N 1501

LL N;
LL A[MAX_N], B[MAX_N];
const LL GETA = 1000000;

int main() {

	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	for (int i = 0; i < N; i++){
		cin >> B[i];
	}

	LL ans = INF;

	for (int s = 0; s < N; s++){

		priority_queue<LL, vector<LL>, greater<LL> > que;

		for (int q = 0; q < N; q++){
			que.push(A[q] * GETA);
		}

		LL e = s - 1;
		if (e < 0)
			e = N - 1;

		for (LL t = s; ; t++){
			if (t == N)
				t = 0;
			LL Mons = que.top();
			que.pop();
			LL Level = Mons / GETA;
			LL Cnt = Mons % GETA;
			Level += B[t] / 2;
			Cnt++;
			que.push(Level*GETA + Cnt);
			if (t == e)
				break;
		}

		LL ret = 0;

		while (que.size()){
			LL c = que.top();
			que.pop();
			c = c % GETA;
			ret = max(ret, c);
		}

		ans = min(ret, ans);

	}

	cout << ans << endl;

	return 0;
}
0