結果

問題 No.9 モンスターのレベル上げ
ユーザー fiordfiord
提出日時 2015-07-09 23:54:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 274 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 151,120 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:54:18
合計ジャッジ時間 4,461 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 274 ms
4,376 KB
testcase_03 AC 215 ms
4,376 KB
testcase_04 AC 115 ms
4,376 KB
testcase_05 AC 75 ms
4,376 KB
testcase_06 AC 25 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 34 ms
4,380 KB
testcase_09 AC 265 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 209 ms
4,376 KB
testcase_12 AC 168 ms
4,380 KB
testcase_13 AC 135 ms
4,376 KB
testcase_14 AC 262 ms
4,376 KB
testcase_15 AC 241 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 154 ms
4,376 KB
testcase_18 AC 130 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	cin>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++)	cin>>a[i];
	for(int i=0;i<n;i++)	cin>>b[i];
	int ans=(1<<30);
	for(int s=0;s<n;s++){
		priority_queue<pair<int,int> > pq;
		for(int i=0;i<n;i++)	pq.push(make_pair(-1*a[i],0));
		int temp=0;
		for(int i=s;i<n;i++){
			int x=pq.top().first;	x-=b[i]/2;
			int y=pq.top().second;	y--;
			temp=max(temp,-1*y);
			pq.pop();	pq.push(make_pair(x,y));
			
		}
		for(int i=0;i<s;i++){
			int x=pq.top().first;	x-=b[i]/2;
			int y=pq.top().second;	y--;
			temp=max(temp,-1*y);
			pq.pop();	pq.push(make_pair(x,y));
		}
		ans=min(ans,temp);
	}
	cout<<ans<<endl;
	return 0;
}
0