結果

問題 No.9 モンスターのレベル上げ
ユーザー hirokazu1020hirokazu1020
提出日時 2015-04-21 22:17:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 277 ms / 5,000 ms
コード長 1,065 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 81,808 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:44:17
合計ジャッジ時間 3,887 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 277 ms
4,380 KB
testcase_03 AC 220 ms
4,376 KB
testcase_04 AC 115 ms
4,376 KB
testcase_05 AC 74 ms
4,380 KB
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 34 ms
4,380 KB
testcase_09 AC 271 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 207 ms
4,380 KB
testcase_12 AC 162 ms
4,376 KB
testcase_13 AC 150 ms
4,376 KB
testcase_14 AC 270 ms
4,376 KB
testcase_15 AC 242 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 157 ms
4,380 KB
testcase_18 AC 131 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())



int main(){
	int n,a[1500],b[1500];
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	int ans=INF;
	rep(i,n){
		int maxlv=0;
		priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
		rep(j,n)pq.push(make_pair(a[j],0));
		pair<int,int> pi;
		for(int j=i;j<n;j++){
			pi=pq.top();
			pq.pop();
			pi.first+=b[j]/2;
			pi.second++;
			pq.push(pi);
			maxlv=max(maxlv,pi.second);
		}
		for(int j=0;j<i;j++){
			pi=pq.top();
			pq.pop();
			pi.first+=b[j]/2;
			pi.second++;
			pq.push(pi);
			maxlv=max(maxlv,pi.second);
		}
		ans=min(ans,maxlv);
	}
	cout<<ans<<endl;
	return 0;
}
0