結果

問題 No.9 モンスターのレベル上げ
ユーザー furafura
提出日時 2020-01-02 17:38:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 378 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 171,356 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-14 18:34:08
合計ジャッジ時間 5,789 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 378 ms
4,376 KB
testcase_03 AC 305 ms
4,376 KB
testcase_04 AC 158 ms
4,380 KB
testcase_05 AC 104 ms
4,376 KB
testcase_06 AC 35 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 47 ms
4,376 KB
testcase_09 AC 367 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 307 ms
4,380 KB
testcase_12 AC 263 ms
4,376 KB
testcase_13 AC 174 ms
4,376 KB
testcase_14 AC 368 ms
4,376 KB
testcase_15 AC 343 ms
4,380 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 AC 222 ms
4,376 KB
testcase_18 AC 178 ms
4,376 KB
testcase_19 AC 4 ms
4,376 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