結果

問題 No.9 モンスターのレベル上げ
ユーザー cocolleaguecocolleague
提出日時 2017-02-04 17:15:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 452 ms / 5,000 ms
コード長 844 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 150,028 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 05:11:46
合計ジャッジ時間 6,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 452 ms
4,380 KB
testcase_03 AC 362 ms
4,380 KB
testcase_04 AC 189 ms
4,380 KB
testcase_05 AC 124 ms
4,376 KB
testcase_06 AC 43 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 57 ms
4,376 KB
testcase_09 AC 438 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 379 ms
4,380 KB
testcase_12 AC 306 ms
4,384 KB
testcase_13 AC 205 ms
4,380 KB
testcase_14 AC 440 ms
4,376 KB
testcase_15 AC 400 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 257 ms
4,376 KB
testcase_18 AC 215 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
static const int INF = 1e8;

int main(void){
	int N;
	int a[3010],b[3010];
	cin >> N;
    rep(i,N){
    	cin >> a[i];
        a[i+N] = a[i];
     }
    rep(i,N){
    	cin >> b[i];
    	b[i+N] = b[i];
    }
    int ans = INF;
    rep(i,N){
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
    for(int j=0;j<N;++j){
     pq.push(make_pair(a[j],0));
    }
    for(int j = i; j < i + N;j++){
    	int llv=pq.top().first;
    	int t = pq.top().second;
    	pq.pop();
    	int lvup = b[j] /2;
    	pq.push(make_pair(llv + lvup,t+1));
    }
    int tmp = 0;
    while(!pq.empty()){
    	int t = pq.top().second;pq.pop();
    	tmp = max(tmp,t);
    }
    ans = min(ans,tmp);

}
cout << ans << endl;
return 0;
}
0