結果

問題 No.9 モンスターのレベル上げ
ユーザー furafura
提出日時 2020-01-02 17:38:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 405 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 173,868 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-02 06:39:57
合計ジャッジ時間 5,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 394 ms
6,940 KB
testcase_03 AC 323 ms
6,944 KB
testcase_04 AC 164 ms
6,940 KB
testcase_05 AC 107 ms
6,940 KB
testcase_06 AC 38 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 48 ms
6,944 KB
testcase_09 AC 389 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 339 ms
6,944 KB
testcase_12 AC 271 ms
6,944 KB
testcase_13 AC 190 ms
6,944 KB
testcase_14 AC 405 ms
6,944 KB
testcase_15 AC 361 ms
6,940 KB
testcase_16 AC 7 ms
6,940 KB
testcase_17 AC 233 ms
6,940 KB
testcase_18 AC 193 ms
6,944 KB
testcase_19 AC 5 ms
6,944 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