結果

問題 No.9 モンスターのレベル上げ
ユーザー imulanimulan
提出日時 2016-06-20 14:15:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 448 ms / 5,000 ms
コード長 1,146 bytes
コンパイル時間 1,584 ms
コンパイル使用メモリ 172,796 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:42:25
合計ジャッジ時間 6,448 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 448 ms
4,376 KB
testcase_03 AC 358 ms
4,380 KB
testcase_04 AC 189 ms
4,376 KB
testcase_05 AC 123 ms
4,376 KB
testcase_06 AC 41 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 55 ms
4,380 KB
testcase_09 AC 434 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 375 ms
4,380 KB
testcase_12 AC 303 ms
4,376 KB
testcase_13 AC 202 ms
4,376 KB
testcase_14 AC 435 ms
4,380 KB
testcase_15 AC 397 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 254 ms
4,380 KB
testcase_18 AC 213 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;

int main()
{
    int n;
    cin >>n;
    vector<int> a(n),b(n);
    rep(i,n) scanf(" %d", &a[i]);
    rep(i,n) scanf(" %d", &b[i]);

    int ans=n;

    //スタート位置
    rep(i,n)
    {
        priority_queue<pi,vector<pi>,greater<pi>> que;

        //(レベル,戦闘回数)
        rep(j,n) que.push(pi(a[j],0));

        //バトルしていく
        rep(j,n)
        {
            pi m=que.top();
            que.pop();

            m.fi+=b[(i+j)%n]/2;
            ++m.se;

            que.push(m);
        }

        //最大の戦闘回数
        int t=0;
        while(!que.empty())
        {
            pi now=que.top();
            que.pop();
            t=max(t,now.se);
        }

        //最小値更新
        ans=min(ans,t);
    }



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