結果

問題 No.9 モンスターのレベル上げ
ユーザー newlife171128newlife171128
提出日時 2018-02-12 20:26:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 393 ms / 5,000 ms
コード長 1,462 bytes
コンパイル時間 2,453 ms
コンパイル使用メモリ 151,716 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 05:43:14
合計ジャッジ時間 6,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 393 ms
4,376 KB
testcase_03 AC 313 ms
4,380 KB
testcase_04 AC 165 ms
4,384 KB
testcase_05 AC 106 ms
4,380 KB
testcase_06 AC 36 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 48 ms
4,376 KB
testcase_09 AC 369 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 314 ms
4,380 KB
testcase_12 AC 231 ms
4,380 KB
testcase_13 AC 171 ms
4,384 KB
testcase_14 AC 377 ms
4,376 KB
testcase_15 AC 342 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 216 ms
4,376 KB
testcase_18 AC 185 ms
4,376 KB
testcase_19 AC 5 ms
4,384 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