結果

問題 No.9 モンスターのレベル上げ
ユーザー TAISA_TAISA_
提出日時 2018-05-31 18:57:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 454 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 4,459 ms
コンパイル使用メモリ 150,364 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 21:02:06
合計ジャッジ時間 6,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 454 ms
4,376 KB
testcase_03 AC 362 ms
4,380 KB
testcase_04 AC 191 ms
4,376 KB
testcase_05 AC 125 ms
4,380 KB
testcase_06 AC 43 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 56 ms
4,380 KB
testcase_09 AC 439 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 382 ms
4,376 KB
testcase_12 AC 294 ms
4,376 KB
testcase_13 AC 203 ms
4,380 KB
testcase_14 AC 444 ms
4,376 KB
testcase_15 AC 402 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 261 ms
4,380 KB
testcase_18 AC 217 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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