結果

問題 No.9 モンスターのレベル上げ
ユーザー tkzw_21tkzw_21
提出日時 2014-12-21 13:22:05
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 396 ms / 5,000 ms
コード長 816 bytes
コンパイル時間 590 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2023-01-21 13:49:33
合計ジャッジ時間 5,113 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
4,900 KB
testcase_01 AC 1 ms
4,904 KB
testcase_02 AC 396 ms
4,904 KB
testcase_03 AC 318 ms
4,900 KB
testcase_04 AC 166 ms
4,900 KB
testcase_05 AC 108 ms
4,900 KB
testcase_06 AC 38 ms
4,904 KB
testcase_07 AC 2 ms
6,948 KB
testcase_08 AC 49 ms
4,900 KB
testcase_09 AC 388 ms
4,904 KB
testcase_10 AC 1 ms
6,952 KB
testcase_11 AC 310 ms
4,904 KB
testcase_12 AC 238 ms
4,904 KB
testcase_13 AC 194 ms
6,952 KB
testcase_14 AC 387 ms
4,900 KB
testcase_15 AC 353 ms
4,904 KB
testcase_16 AC 7 ms
4,900 KB
testcase_17 AC 225 ms
6,948 KB
testcase_18 AC 188 ms
4,900 KB
testcase_19 AC 4 ms
4,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <map>
#include <cstring>
#include <algorithm>
#define INF 114514

using namespace std;

typedef pair<int,int> P;

int main(void){
	priority_queue<P,vector<P>,greater<P> > que,pq;	
	int n;
	cin >> n;
	vector<int> b(n);
	for(int i=0;i<n;i++){
		int a;cin >> a;
		pq.push(make_pair(a,0));
	}
	for(int i=0;i<n;i++)
		cin >> b[i];
	
	int ret = INF;
	for(int i=0;i<n;i++){
		que = pq;
		for(int j=0;j<n;j++){
			P p = que.top();que.pop();
			p.first += b[(i+j)%n]/2;
			p.second += 1;
			que.push(p);
		}

		int cnt = 0;
		while(!que.empty()){
			P p = que.top();que.pop();
			cnt = max(cnt,p.second);
			// cout << p.second << " ";
		}
		// cout << cnt << endl;
		ret = min(ret,cnt);
	}
	cout << ret << endl;
	return 0;
}
0