結果

問題 No.9 モンスターのレベル上げ
ユーザー kurenai3110kurenai3110
提出日時 2018-04-06 14:14:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 215 ms / 5,000 ms
コード長 824 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 78,716 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 17:58:48
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 215 ms
4,376 KB
testcase_03 AC 125 ms
4,380 KB
testcase_04 AC 92 ms
4,380 KB
testcase_05 AC 62 ms
4,380 KB
testcase_06 AC 20 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 25 ms
4,376 KB
testcase_09 AC 196 ms
4,376 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 202 ms
4,384 KB
testcase_12 AC 169 ms
4,380 KB
testcase_13 AC 147 ms
4,380 KB
testcase_14 AC 198 ms
4,384 KB
testcase_15 AC 197 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 130 ms
4,380 KB
testcase_18 AC 104 ms
4,384 KB
testcase_19 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <functional>
using namespace std;
#define INF (int)1e7

int main()
{
	int n; cin >> n;
	vector<int>A(n), B(n);
	for (int i = 0; i < n; i++)cin >> A[i];
	for (int i = 0; i < n; i++)cin >> B[i];
	int mincnt = INF;
	
	for (int i = 0; i < n; i++) {
		priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>C;
		for (int j = 0; j < n; j++)C.push(make_pair(A[j],0));

		int cnt = 0;
		for (int j = 0; j < n; j++) {
			pair<int, int> p = C.top(); C.pop();
			p.first += B[j]/2;
			p.second++;
			if (p.second > mincnt)break;
			cnt = max(cnt, p.second);
			C.push(p);
		}
		mincnt = min(mincnt,cnt);

		B.push_back(B[0]);
		B.erase(B.begin());
	}

	cout << mincnt << endl;

    return 0;
}
0