結果

問題 No.9 モンスターのレベル上げ
ユーザー kurenai3110kurenai3110
提出日時 2016-12-13 17:26:47
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 826 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 78,088 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 05:02:21
合計ジャッジ時間 3,558 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 206 ms
4,376 KB
testcase_03 AC 116 ms
4,380 KB
testcase_04 AC 86 ms
4,376 KB
testcase_05 AC 59 ms
4,380 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 23 ms
4,376 KB
testcase_09 AC 188 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 192 ms
4,376 KB
testcase_12 AC 165 ms
4,376 KB
testcase_13 AC 150 ms
4,380 KB
testcase_14 AC 192 ms
4,376 KB
testcase_15 AC 191 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 123 ms
4,376 KB
testcase_18 AC 99 ms
4,380 KB
testcase_19 AC 3 ms
4,376 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-1; 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