結果

問題 No.9 モンスターのレベル上げ
ユーザー BantakoBantako
提出日時 2018-06-13 16:02:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 442 ms / 5,000 ms
コード長 867 bytes
コンパイル時間 1,503 ms
コンパイル使用メモリ 173,204 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 03:54:19
合計ジャッジ時間 7,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 442 ms
4,380 KB
testcase_03 AC 353 ms
4,376 KB
testcase_04 AC 184 ms
4,376 KB
testcase_05 AC 120 ms
4,376 KB
testcase_06 AC 41 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 55 ms
4,376 KB
testcase_09 AC 433 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 359 ms
4,380 KB
testcase_12 AC 299 ms
4,376 KB
testcase_13 AC 201 ms
4,380 KB
testcase_14 AC 434 ms
4,376 KB
testcase_15 AC 392 ms
4,376 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 252 ms
4,376 KB
testcase_18 AC 209 ms
4,380 KB
testcase_19 AC 4 ms
4,376 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