結果

問題 No.9 モンスターのレベル上げ
ユーザー goodbatongoodbaton
提出日時 2015-07-16 00:15:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 210 ms / 5,000 ms
コード長 1,122 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 79,336 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 03:54:29
合計ジャッジ時間 3,299 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 207 ms
4,380 KB
testcase_03 AC 168 ms
4,380 KB
testcase_04 AC 86 ms
4,376 KB
testcase_05 AC 56 ms
4,384 KB
testcase_06 AC 21 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 28 ms
4,376 KB
testcase_09 AC 198 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 129 ms
4,376 KB
testcase_12 AC 116 ms
4,380 KB
testcase_13 AC 114 ms
4,376 KB
testcase_14 AC 210 ms
4,380 KB
testcase_15 AC 188 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 120 ms
4,376 KB
testcase_18 AC 100 ms
4,376 KB
testcase_19 AC 3 ms
4,376 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