結果

問題 No.9 モンスターのレベル上げ
ユーザー mbanmban
提出日時 2017-01-15 03:20:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 267 ms / 5,000 ms
コード長 649 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 78,328 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:06:10
合計ジャッジ時間 4,053 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 267 ms
4,376 KB
testcase_03 AC 214 ms
4,376 KB
testcase_04 AC 111 ms
4,380 KB
testcase_05 AC 72 ms
4,380 KB
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 33 ms
4,380 KB
testcase_09 AC 264 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 202 ms
4,380 KB
testcase_12 AC 172 ms
4,376 KB
testcase_13 AC 154 ms
4,380 KB
testcase_14 AC 264 ms
4,376 KB
testcase_15 AC 240 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 152 ms
4,376 KB
testcase_18 AC 127 ms
4,380 KB
testcase_19 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<queue>


using namespace std;

#define p pair<int,int>


int main() {
	int n;
	int i, j;
	int ans;
	cin >> n;
	vector<int>a(n);
	vector<int>b(n);
	b = vector<int>(n);
	for (int i = 0; i<n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i<n; i++) {
		cin >> b[i];
	}
	ans = n;
	for (i = 0; i<n; i++) {
		int t = 0;
		priority_queue<p, vector<p>, greater<p>> pq;
		for (j = 0; j<n; j++) {
			pq.push(p(a[j], 0));
		}
		for (j = 0; j<n; j++) {
			p m = pq.top();
			pq.pop();
			m.first += b[(i + j) % n] / 2;
			++m.second;
			t = max(t, m.second);
			pq.push(m);
		}
		ans = min(ans, t);
	}
	cout << ans << endl;
	return 0;
}

0