結果

問題 No.9 モンスターのレベル上げ
ユーザー Sounds_Of_RainSounds_Of_Rain
提出日時 2015-07-21 11:09:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 219 ms / 5,000 ms
コード長 905 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 77,832 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-06 03:55:03
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 219 ms
4,384 KB
testcase_03 AC 175 ms
4,380 KB
testcase_04 AC 93 ms
4,384 KB
testcase_05 AC 62 ms
4,380 KB
testcase_06 AC 22 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 28 ms
4,388 KB
testcase_09 AC 214 ms
4,384 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 149 ms
4,380 KB
testcase_12 AC 121 ms
4,384 KB
testcase_13 AC 114 ms
4,380 KB
testcase_14 AC 215 ms
4,380 KB
testcase_15 AC 195 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 125 ms
4,380 KB
testcase_18 AC 106 ms
4,384 KB
testcase_19 AC 3 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

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+i; 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