結果

問題 No.9 モンスターのレベル上げ
ユーザー maimai
提出日時 2016-06-14 21:22:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 169,908 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 19:39:51
合計ジャッジ時間 5,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 313 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 30 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 41 ms
5,376 KB
testcase_09 AC 303 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 191 ms
5,376 KB
testcase_14 AC 302 ms
5,376 KB
testcase_15 AC 279 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 179 ms
5,376 KB
testcase_18 AC 148 ms
5,376 KB
testcase_19 AC 5 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
typedef long long int ll;

int calc(vector<int> &ev,vector<int> &mv,int offset){
    priority_queue<pair<int,int>> pq;
    for (int e:mv)
        pq.push(make_pair(-e,0));
    
    int i,j,max=0;
    for (j=0;j<ev.size();j++){
        i=(j+offset)%ev.size();
        int p=-pq.top().first;
        int q=-pq.top().second;pq.pop();
        p+=ev[i]/2;
        if (max<++q) max=q;
        pq.push(make_pair(-p,-q));
    }
    return max;
}

int main(){
    int i,j,k,l;
    int x,y,d;
    int n,m;
    
    cin >> n;
    vector<int> mee(n);
    vector<int> ene(n);
    
    for (i=0;i<n;i++){
        scanf("%d",&j);
        mee[i]=j;
    }
    for (i=0;i<n;i++){
        scanf("%d",&j);
        ene[i]=j;
    }
    
    int min=0xFFFF;
    for (i=0;i<n;i++){
        int u=calc(mee,ene,i);
        if (min>u) min=u;
    }
    cout<<min<<endl;
    
    
    return 0;
    
}
0