結果

問題 No.9 モンスターのレベル上げ
ユーザー TAISA_
提出日時 2018-05-31 18:57:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 437 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 166,056 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 08:35:54
合計ジャッジ時間 6,330 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
int main(){
    int n;cin>>n;
    int a[1510],b[1510];
    int ans=INF;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++){
		priority_queue<P,vector<P>,greater<P>> q;
		for(int j=0;j<n;j++){
			q.push(P(a[j],0));
		}
		for(int j=i;j<i+n;j++){
			int p=j%n;
			P c=q.top();
			q.pop();
			c.first+=b[p]/2;
			c.second++;
			q.push(c);
		}
		int ma=0;
		while(!q.empty()){
			P p=q.top();q.pop();
			ma=max(p.second,ma);
		}
		ans=min(ans,ma);
	}
	cout<<ans<<endl;
    return 0;
}
0