結果

問題 No.9 モンスターのレベル上げ
ユーザー furafura
提出日時 2020-01-02 17:38:59
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 430 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 1,475 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2022-12-28 04:43:47
合計ジャッジ時間 6,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
4,900 KB
testcase_01 AC 1 ms
6,952 KB
testcase_02 AC 430 ms
4,904 KB
testcase_03 AC 344 ms
4,900 KB
testcase_04 AC 180 ms
4,904 KB
testcase_05 AC 118 ms
4,908 KB
testcase_06 AC 40 ms
4,900 KB
testcase_07 AC 2 ms
4,900 KB
testcase_08 AC 53 ms
4,904 KB
testcase_09 AC 424 ms
6,948 KB
testcase_10 AC 2 ms
4,904 KB
testcase_11 AC 350 ms
4,904 KB
testcase_12 AC 292 ms
6,948 KB
testcase_13 AC 234 ms
4,904 KB
testcase_14 AC 425 ms
4,900 KB
testcase_15 AC 380 ms
4,900 KB
testcase_16 AC 7 ms
4,900 KB
testcase_17 AC 247 ms
4,904 KB
testcase_18 AC 204 ms
6,952 KB
testcase_19 AC 5 ms
4,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n),b(n);
	rep(i,n) scanf("%d",&a[i]);
	rep(i,n) scanf("%d",&b[i]);

	int ans=n;
	rep(t,n){
		priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q;
		rep(i,n) Q.emplace(a[i],0);
		rep(i,n){
			auto p=Q.top(); Q.pop();
			Q.emplace(p.first+b[(i+t)%n]/2,p.second+1);
		}

		int res=0;
		while(!Q.empty()) res=max(res,Q.top().second), Q.pop();
		ans=min(ans,res);
	}
	printf("%d\n",ans);

	return 0;
}
0