結果

問題 No.9 モンスターのレベル上げ
ユーザー ytftytft
提出日時 2022-11-02 17:13:46
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,529 ms / 5,000 ms
コード長 736 bytes
コンパイル時間 3,505 ms
コンパイル使用メモリ 254,556 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 06:05:38
合計ジャッジ時間 26,522 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2,095 ms
4,376 KB
testcase_03 AC 1,612 ms
4,380 KB
testcase_04 AC 861 ms
4,380 KB
testcase_05 AC 573 ms
4,380 KB
testcase_06 AC 201 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 267 ms
4,380 KB
testcase_09 AC 2,016 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2,649 ms
4,384 KB
testcase_12 AC 3,529 ms
4,380 KB
testcase_13 AC 1,767 ms
4,376 KB
testcase_14 AC 2,023 ms
4,376 KB
testcase_15 AC 1,823 ms
4,376 KB
testcase_16 AC 34 ms
4,380 KB
testcase_17 AC 1,195 ms
4,376 KB
testcase_18 AC 989 ms
4,376 KB
testcase_19 AC 20 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	auto compare=[](vector<int> a,vector<int> b){
		if(a[0]!=b[0]){
			return a[0]>b[0];
		}else{
			return a[1]>b[1];
		}
	};
	int N;
	scanf("%d",&N);
	int A[N],B[N];
	for(int i=0;i<N;++i){
		scanf("%d",&A[i]);
	}
	for(int i=0;i<N;++i){
		scanf("%d",&B[i]);
	}
	int ans=N;
	for(int i=0;i<N;++i){
		priority_queue<vector<int>,vector<vector<int>>,decltype(compare)>q {compare};
		int cand=0;
		for(int j=0;j<N;++j){
			q.push((vector<int>){A[j],0});
		}
		for(int j=0;j<N;++j){
			vector<int> temp=q.top();
			q.pop();
			temp[0]+=B[(i+j)%N]/2;
			++temp[1];
			if(cand<temp[1]){
				cand=temp[1];
			}
			q.push(temp);
		}
		if(ans>cand){
			ans=cand;
		}
	}
	printf("%d\n",ans);
}
0