結果

問題 No.9 モンスターのレベル上げ
ユーザー togari_takamototogari_takamoto
提出日時 2015-12-13 05:07:00
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 578 ms / 5,000 ms
コード長 1,019 bytes
コンパイル時間 726 ms
使用メモリ 3,564 KB
最終ジャッジ日時 2023-01-21 15:24:58
合計ジャッジ時間 6,841 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,420 KB
testcase_01 AC 1 ms
3,400 KB
testcase_02 AC 578 ms
3,456 KB
testcase_03 AC 459 ms
3,456 KB
testcase_04 AC 241 ms
3,504 KB
testcase_05 AC 157 ms
3,484 KB
testcase_06 AC 53 ms
3,464 KB
testcase_07 AC 3 ms
3,448 KB
testcase_08 AC 72 ms
3,508 KB
testcase_09 AC 559 ms
3,564 KB
testcase_10 AC 1 ms
3,364 KB
testcase_11 AC 501 ms
3,504 KB
testcase_12 AC 368 ms
3,468 KB
testcase_13 AC 261 ms
3,488 KB
testcase_14 AC 560 ms
3,536 KB
testcase_15 AC 513 ms
3,536 KB
testcase_16 AC 10 ms
3,388 KB
testcase_17 AC 329 ms
3,504 KB
testcase_18 AC 276 ms
3,448 KB
testcase_19 AC 6 ms
3,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <iomanip>
#include <numeric>
#include <memory>
#include <limits.h>
#include <set>
#include <cassert>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0; i<(n); ++i)
#define TEN(x) ((ll)1e##x)
#define ALL(v) (v).begin(), (v).end()

int main(){
	ll n;
	cin >>  n;
	vector<ll> a(n);
	vector<ll> b(n);
	for (auto&i : a) cin >> i;
	for (auto&i : b) cin >> i;
	using P = pair<ll, ll>;
	ll min_c = 1501;
	REP(start, n){
		priority_queue<P, vector<P>, greater<P>> que;
		for (auto&i : a) que.push({i, 0});
		REP(i, n) {
			ll j = (i + start) % n;
			P p = que.top(); que.pop();
			que.push({p.first+b[j]/2, p.second+1});
		}
		priority_queue<ll> max_c;
		while(!que.empty()) { max_c.push(que.top().second); que.pop(); }
		min_c = min(min_c, max_c.top());
	}

	cout << min_c << endl;
	return 0;
}
0