結果

問題 No.9 モンスターのレベル上げ
ユーザー 沙耶花沙耶花
提出日時 2021-10-20 20:58:52
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 506 ms / 5,000 ms
コード長 746 bytes
コンパイル時間 3,938 ms
使用メモリ 6,324 KB
最終ジャッジ日時 2023-03-28 17:04:59
合計ジャッジ時間 10,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
6,324 KB
testcase_01 AC 1 ms
6,256 KB
testcase_02 AC 506 ms
6,268 KB
testcase_03 AC 400 ms
6,172 KB
testcase_04 AC 210 ms
6,320 KB
testcase_05 AC 137 ms
6,176 KB
testcase_06 AC 47 ms
6,276 KB
testcase_07 AC 2 ms
6,256 KB
testcase_08 AC 63 ms
6,280 KB
testcase_09 AC 491 ms
6,272 KB
testcase_10 AC 2 ms
6,252 KB
testcase_11 AC 431 ms
6,280 KB
testcase_12 AC 319 ms
6,280 KB
testcase_13 AC 212 ms
6,176 KB
testcase_14 AC 492 ms
6,168 KB
testcase_15 AC 445 ms
6,200 KB
testcase_16 AC 8 ms
6,208 KB
testcase_17 AC 288 ms
6,276 KB
testcase_18 AC 239 ms
6,276 KB
testcase_19 AC 5 ms
6,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001



int main(){
	int n;
	cin>>n;
	
	vector<int> a(n),b(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	int ans = Inf;
	rep(_,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();
			p.second++;
			p.first += b[i]/2;
			Q.push(p);
		}
		int temp = 0;
		while(Q.size()>0){
			temp = max(temp,Q.top().second);
			Q.pop();
		}
		ans = min(ans,temp);
		
		b.push_back(b[0]);
		b.erase(b.begin());
	}
	cout<<ans<<endl;
	
	return 0;
}
0