結果

問題 No.9 モンスターのレベル上げ
ユーザー newlife171128newlife171128
提出日時 2018-02-12 20:26:45
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 395 ms / 5,000 ms
コード長 1,462 bytes
コンパイル時間 2,187 ms
使用メモリ 3,636 KB
最終ジャッジ日時 2023-01-21 17:04:24
合計ジャッジ時間 5,892 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,444 KB
testcase_01 AC 2 ms
3,504 KB
testcase_02 AC 395 ms
3,612 KB
testcase_03 AC 316 ms
3,592 KB
testcase_04 AC 166 ms
3,420 KB
testcase_05 AC 108 ms
3,416 KB
testcase_06 AC 37 ms
3,576 KB
testcase_07 AC 2 ms
3,544 KB
testcase_08 AC 49 ms
3,636 KB
testcase_09 AC 385 ms
3,588 KB
testcase_10 AC 2 ms
3,500 KB
testcase_11 AC 319 ms
3,560 KB
testcase_12 AC 237 ms
3,612 KB
testcase_13 AC 178 ms
3,436 KB
testcase_14 AC 385 ms
3,500 KB
testcase_15 AC 351 ms
3,616 KB
testcase_16 AC 7 ms
3,452 KB
testcase_17 AC 225 ms
3,556 KB
testcase_18 AC 188 ms
3,432 KB
testcase_19 AC 5 ms
3,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include "bits/stdc++.h"
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <unordered_map>
#include <string.h>
#include <utility>

typedef long long ll;
const int INF = 1e8;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;

typedef pair<int, int> P;

int n = 0;
priority_queue<P, vector<P>, greater<P>> Q;
priority_queue<P, vector<P>, greater<P>> Qq;

vector<P> motimons;
P tmpmons;
int tekimons[3010];

void inite() {
	for (int i = 0; i < n; i++) {
		Qq.push(motimons[i]);
	}
}

int main() {

	cin >> n;

	int tmp;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		motimons.push_back(P(tmp, 0));
	}
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		tekimons[i] = tmp;
		tekimons[n + i] = tmp;
	}
	inite();
	/*	for (int i = 0; i < n * 2; i++) {
	 cout << tekimons[i] << endl;
	 }*/

	int ans = 100000000;
	for (int k = 0; k < n ; k++) {
		Q = Qq;

		int mct=-1;
		for (int i = k; i < n +k; i++) {
			P p = Q.top();
			Q.pop();

			int level = p.first;
			int ct = p.second;

			level = level + (tekimons[i] / 2);
			ct++;

			Q.push(P(level, ct));
		}

		while (!Q.empty()) {
			P p = Q.top();
			Q.pop();

			mct = max(mct,p.second);

		/*	cout << p.first << " " << p.second << endl;*/
		}

		ans = min(ans, mct);
	}

	cout<<ans<<endl;

	return 0;
}
0