結果

問題 No.9 モンスターのレベル上げ
ユーザー goodbatongoodbaton
提出日時 2015-07-16 00:15:22
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 212 ms / 5,000 ms
コード長 1,122 bytes
コンパイル時間 580 ms
使用メモリ 3,660 KB
最終ジャッジ日時 2023-01-21 14:40:33
合計ジャッジ時間 3,520 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,544 KB
testcase_01 AC 2 ms
3,444 KB
testcase_02 AC 212 ms
3,660 KB
testcase_03 AC 170 ms
3,620 KB
testcase_04 AC 89 ms
3,592 KB
testcase_05 AC 59 ms
3,564 KB
testcase_06 AC 22 ms
3,556 KB
testcase_07 AC 2 ms
3,520 KB
testcase_08 AC 28 ms
3,652 KB
testcase_09 AC 209 ms
3,656 KB
testcase_10 AC 2 ms
3,624 KB
testcase_11 AC 128 ms
3,616 KB
testcase_12 AC 119 ms
3,484 KB
testcase_13 AC 115 ms
3,660 KB
testcase_14 AC 210 ms
3,616 KB
testcase_15 AC 189 ms
3,552 KB
testcase_16 AC 5 ms
3,520 KB
testcase_17 AC 121 ms
3,492 KB
testcase_18 AC 101 ms
3,580 KB
testcase_19 AC 3 ms
3,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>

typedef long long ll;
using namespace std;

#define mod 1000000007
#define INF 1000000000
#define LLINF 2000000000000000000LL

#define SIZE 10000


int main(){
    int n,ans=INF;
    int A[SIZE],B[SIZE];
    priority_queue<pair<int,int> > st;
    
    
    scanf("%d",&n);

    for(int i=0;i<n;i++){
        scanf("%d",&A[i]);
        
        st.push(make_pair(-A[i],0));
    }
    
    for(int i=0;i<n;i++)
        scanf("%d",&B[i]);
    
    for(int i=0;i<n;i++){
        priority_queue<pair<int,int> > pq =st;
        int cc=0;
        
        for(int j=0;j<n;j++){
            
            pair<int,int> p = pq.top();
            pq.pop();
            
            p.second--;
            p.first-=B[(i+j)%n]/2;
            
            cc = max(cc,-p.second);
            
            pq.push(p);
        }
        
        ans = min(ans,cc);
    }
    
    cout << ans << endl;
    
    return 0;
}
0