結果

問題 No.9 モンスターのレベル上げ
ユーザー kenken714kenken714
提出日時 2019-04-17 20:56:25
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 489 ms / 5,000 ms
コード長 1,106 bytes
コンパイル時間 632 ms
使用メモリ 3,640 KB
最終ジャッジ日時 2022-11-21 17:12:46
合計ジャッジ時間 5,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,428 KB
testcase_01 AC 2 ms
3,388 KB
testcase_02 AC 489 ms
3,476 KB
testcase_03 AC 389 ms
3,640 KB
testcase_04 AC 203 ms
3,468 KB
testcase_05 AC 131 ms
3,528 KB
testcase_06 AC 43 ms
3,504 KB
testcase_07 AC 2 ms
3,520 KB
testcase_08 AC 59 ms
3,420 KB
testcase_09 AC 471 ms
3,540 KB
testcase_10 AC 1 ms
3,504 KB
testcase_11 AC 414 ms
3,476 KB
testcase_12 AC 312 ms
3,628 KB
testcase_13 AC 203 ms
3,536 KB
testcase_14 AC 474 ms
3,476 KB
testcase_15 AC 436 ms
3,472 KB
testcase_16 AC 8 ms
3,512 KB
testcase_17 AC 278 ms
3,576 KB
testcase_18 AC 230 ms
3,456 KB
testcase_19 AC 5 ms
3,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, ans = INF;
int main() {
	cin >> n;
	vector<ll>a(n), b(n);
	REP(i, n)cin >> a[i];
	REP(i, n)cin >> b[i];
	REP(i, n)b.push_back(b[i]);
	REP(i, n) {
		ll nowans = 0;
		priority_queue<P, vector<P>, greater<P> > q;
		REP(i, n)q.push(P(a[i], 0));
		FOR(j, i, i + n) {
			P now = q.top();
			q.pop();
			now.first += b[j] / 2;
			now.second++;
			q.push(now);
		}
		while (!q.empty()) {
			nowans = max(nowans, q.top().second);
			q.pop();
		}
		ans = min(ans, nowans);
	}
	cout << ans << endl;
}

0