結果

問題 No.9 モンスターのレベル上げ
ユーザー sigma425sigma425
提出日時 2015-04-25 10:48:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 387 ms / 5,000 ms
コード長 777 bytes
コンパイル時間 1,197 ms
コンパイル使用メモリ 151,868 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:45:02
合計ジャッジ時間 5,408 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 387 ms
4,376 KB
testcase_03 AC 311 ms
4,376 KB
testcase_04 AC 160 ms
4,376 KB
testcase_05 AC 103 ms
4,376 KB
testcase_06 AC 36 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 48 ms
4,376 KB
testcase_09 AC 382 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 305 ms
4,376 KB
testcase_12 AC 238 ms
4,376 KB
testcase_13 AC 194 ms
4,376 KB
testcase_14 AC 386 ms
4,376 KB
testcase_15 AC 348 ms
4,380 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 226 ms
4,376 KB
testcase_18 AC 187 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef pair<int,int> P;
int B[1500];
int main(){
	int N;
	cin>>N;
	priority_queue<P,vector<P>,greater<P> > que,qc;
	rep(i,N){
		int a;
		cin>>a;
		qc.push(P(a,0));
	}
	rep(i,N) cin>>B[i];
	int mn=1e9;
	rep(i,N){
		que=qc;
		rep(j,N){
			P p=que.top();
			que.pop();
			que.push(P(p.fs+B[(i+j)%N]/2,p.sc+1));
		}
		int mx=0;
		while(!que.empty()){
			P p=que.top();
			que.pop();
			chmax(mx,p.sc);
		}
		chmin(mn,mx);
	}
	cout<<mn<<endl;
}
0