結果

問題 No.9 モンスターのレベル上げ
ユーザー BantakoBantako
提出日時 2018-06-13 16:02:34
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 436 ms / 5,000 ms
コード長 867 bytes
コンパイル時間 1,447 ms
使用メモリ 3,540 KB
最終ジャッジ日時 2023-01-31 09:07:22
合計ジャッジ時間 6,612 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,380 KB
testcase_01 AC 1 ms
3,420 KB
testcase_02 AC 436 ms
3,460 KB
testcase_03 AC 348 ms
3,468 KB
testcase_04 AC 182 ms
3,464 KB
testcase_05 AC 119 ms
3,492 KB
testcase_06 AC 41 ms
3,384 KB
testcase_07 AC 2 ms
3,376 KB
testcase_08 AC 55 ms
3,396 KB
testcase_09 AC 427 ms
3,476 KB
testcase_10 AC 2 ms
3,456 KB
testcase_11 AC 358 ms
3,540 KB
testcase_12 AC 303 ms
3,460 KB
testcase_13 AC 217 ms
3,420 KB
testcase_14 AC 430 ms
3,496 KB
testcase_15 AC 386 ms
3,480 KB
testcase_16 AC 7 ms
3,472 KB
testcase_17 AC 250 ms
3,416 KB
testcase_18 AC 207 ms
3,468 KB
testcase_19 AC 5 ms
3,476 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    rep(i,0,N)cin >> A[i];
    rep(i,0,N)cin >> B[i];

    int mini = INF;
    rep(i,0,N){
        priority_queue< P, vector< P >, greater< P > > que;
        rep(j,0,N)que.push( P(A[j], 0) );
        rep(j,0,N){
            //next = (i + j) % N
            P p = que.top();
            que.pop();

            p.first += B[(i + j) % N] / 2;
            p.second ++;
            que.push(p);
        }
        int maxi = 0;
        while(!que.empty()){
            P p = que.top();
            que.pop();
            maxi = max(maxi, p.second);
        }
        mini = min(mini, maxi);
    }

    cout << mini << endl;
}
0