結果

問題 No.9 モンスターのレベル上げ
ユーザー Sounds_Of_RainSounds_Of_Rain
提出日時 2015-07-21 11:04:58
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 897 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 77,500 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 20:54:23
合計ジャッジ時間 2,339 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <queue>
#include <cmath>
using namespace std;

const int INF=1000000;
const int MOD = 100000;
typedef long long int llint;
int main(){
	int n, ans = INF;
	int A[15000];
	int B[15000];
	priority_queue<pair<int, int>> a;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> A[i];
		a.push(make_pair(-A[i], 0));
	}
	for (int i = 0; i < n; i++){
		cin >> B[i];
	}
	for (int i = 0; i < n; i++){
		int cc = 0;
		priority_queue<pair<int, int>>b = a;
		for (int j = i; j < n; j++){
			pair<int, int>P = b.top();
			b.pop();
			if (j < n){
				P.first -= B[j] / 2;
			}
			else{ P.first -= B[j - n]/2; }
			P.second--;
			b.push(P);
			cc = max(cc, -P.second);
		}
		ans = min(ans, cc);
	}
	cout << ans << endl;
	return 0;

}
0