結果

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

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,456 KB
testcase_01 AC 1 ms
3,552 KB
testcase_02 AC 207 ms
3,588 KB
testcase_03 AC 115 ms
3,428 KB
testcase_04 AC 85 ms
3,404 KB
testcase_05 AC 58 ms
3,516 KB
testcase_06 AC 19 ms
3,568 KB
testcase_07 AC 2 ms
3,488 KB
testcase_08 AC 23 ms
3,476 KB
testcase_09 AC 185 ms
3,496 KB
testcase_10 WA -
testcase_11 AC 190 ms
3,552 KB
testcase_12 AC 165 ms
3,428 KB
testcase_13 AC 147 ms
3,496 KB
testcase_14 AC 190 ms
3,500 KB
testcase_15 AC 187 ms
3,572 KB
testcase_16 AC 3 ms
3,540 KB
testcase_17 AC 121 ms
3,576 KB
testcase_18 AC 98 ms
3,488 KB
testcase_19 AC 3 ms
3,560 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