結果

問題 No.9 モンスターのレベル上げ
ユーザー togari_takamototogari_takamoto
提出日時 2015-12-13 05:07:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 572 ms / 5,000 ms
コード長 1,019 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 98,448 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:27:12
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 572 ms
4,376 KB
testcase_03 AC 456 ms
4,376 KB
testcase_04 AC 240 ms
4,380 KB
testcase_05 AC 157 ms
4,380 KB
testcase_06 AC 54 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 72 ms
4,376 KB
testcase_09 AC 557 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 499 ms
4,376 KB
testcase_12 AC 366 ms
4,376 KB
testcase_13 AC 263 ms
4,380 KB
testcase_14 AC 558 ms
4,376 KB
testcase_15 AC 510 ms
4,376 KB
testcase_16 AC 9 ms
4,376 KB
testcase_17 AC 323 ms
4,376 KB
testcase_18 AC 273 ms
4,376 KB
testcase_19 AC 6 ms
4,380 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