結果

問題 No.9 モンスターのレベル上げ
ユーザー okadukiokaduki
提出日時 2016-06-17 16:44:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 427 ms / 5,000 ms
コード長 714 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 77,664 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:42:07
合計ジャッジ時間 5,272 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 427 ms
4,380 KB
testcase_03 AC 341 ms
4,380 KB
testcase_04 AC 179 ms
4,376 KB
testcase_05 AC 116 ms
4,380 KB
testcase_06 AC 39 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 52 ms
4,380 KB
testcase_09 AC 424 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 356 ms
4,376 KB
testcase_12 AC 283 ms
4,380 KB
testcase_13 AC 189 ms
4,380 KB
testcase_14 AC 420 ms
4,376 KB
testcase_15 AC 379 ms
4,380 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 244 ms
4,376 KB
testcase_18 AC 204 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<vector>
#include <utility>
#include <queue>
using namespace std;
#define MP make_pair
using PII = pair<int,int>;

int main() {
	int N; cin >> N;
	vector<int> xs(N);
	for(int i=0;i<N;++i) cin >> xs[i];
	vector<int> ys(N*2);
	for(int i=0;i<N;++i){
	 cin >> ys[i];
		ys[i+N] = ys[i];
	}
	
	int ans = 1e9;
	for(int i=0;i<N;++i){
		priority_queue<PII,vector<PII>,greater<PII>> pq;
		for(int i=0;i<N;++i) pq.push(MP(xs[i], 0));
		for(int j=0;j<N;++j){
			auto p = pq.top(); pq.pop();
			p.first += ys[i+j]/2;
			p.second++;
			pq.push(p);
		}
		int mx = 0;
		while(!pq.empty()){
			mx = max(mx, pq.top().second);
			pq.pop();
		}
		ans = min(ans, mx);
	}
	cout << ans << endl;
	
	return 0;
}
0