結果

問題 No.9 モンスターのレベル上げ
ユーザー TAISA_TAISA_
提出日時 2018-05-31 18:57:12
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 454 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 2,048 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2023-01-31 01:09:52
合計ジャッジ時間 7,577 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
4,900 KB
testcase_01 AC 2 ms
4,904 KB
testcase_02 AC 454 ms
4,904 KB
testcase_03 AC 362 ms
4,904 KB
testcase_04 AC 190 ms
4,904 KB
testcase_05 AC 124 ms
6,948 KB
testcase_06 AC 42 ms
4,900 KB
testcase_07 AC 2 ms
6,948 KB
testcase_08 AC 57 ms
4,900 KB
testcase_09 AC 442 ms
4,908 KB
testcase_10 AC 2 ms
4,900 KB
testcase_11 AC 381 ms
4,904 KB
testcase_12 AC 296 ms
4,900 KB
testcase_13 AC 204 ms
6,952 KB
testcase_14 AC 443 ms
4,900 KB
testcase_15 AC 404 ms
6,948 KB
testcase_16 AC 8 ms
4,900 KB
testcase_17 AC 259 ms
4,908 KB
testcase_18 AC 217 ms
4,904 KB
testcase_19 AC 5 ms
4,904 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