結果

問題 No.9 モンスターのレベル上げ
ユーザー momoyuumomoyuu
提出日時 2022-08-24 00:45:02
言語 C++23(draft)
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 309 ms / 5,000 ms
コード長 1,475 bytes
コンパイル時間 2,821 ms
使用メモリ 6,952 KB
最終ジャッジ日時 2022-12-04 05:56:32
合計ジャッジ時間 6,711 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
6,948 KB
testcase_01 AC 1 ms
4,900 KB
testcase_02 AC 309 ms
4,904 KB
testcase_03 AC 259 ms
4,904 KB
testcase_04 AC 125 ms
4,904 KB
testcase_05 AC 86 ms
4,900 KB
testcase_06 AC 29 ms
4,900 KB
testcase_07 AC 1 ms
4,904 KB
testcase_08 AC 35 ms
4,900 KB
testcase_09 AC 306 ms
4,904 KB
testcase_10 AC 1 ms
4,900 KB
testcase_11 AC 249 ms
4,900 KB
testcase_12 AC 268 ms
6,952 KB
testcase_13 AC 216 ms
6,952 KB
testcase_14 AC 298 ms
4,904 KB
testcase_15 AC 270 ms
6,952 KB
testcase_16 AC 6 ms
4,900 KB
testcase_17 AC 167 ms
6,948 KB
testcase_18 AC 134 ms
4,904 KB
testcase_19 AC 3 ms
4,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template<class t> using vc = vector<t>;
template<class t> using vvc = vc<vc<t>>;
using pi = pair<int,int>;
using vi = vc<int>;
using vvi = vvc<int>;

#define rep(i,a,b) for (int i = a; i < b; i++)
#define irep(i,a,b) for (int i = a; i > b; i--)
#define print(n) cout << n << endl
#define pritn(n) print(n)
#define rup(a,b) (a+b-1)/b
#define input(A,N) rep(i,0,N) cin>>A[i];


int main(){
    cout << fixed << setprecision(15);
    
    int n;
    cin >> n;
    vc<ll> a(n);
    vc<ll> b(n);
    input(a,n);
    input(b,n);
    ll ans = n;
    auto val = [](pair<ll,ll> &a, pair<ll,ll> &b){
        if (a.first==b.first) return a.second>b.second;
        else return a.first > b.first;
    };
    rep(i,0,n){
        priority_queue<pair<ll,ll>,vc<pair<ll,ll>>,greater<pair<ll,ll>>> que;
        rep(j,0,n){
            que.push(pair<ll,ll>(a[j],0));
        }
        ll count = 0;
        rep(j,0,n){
            pair<ll,ll> now = que.top();
            que.pop();
            now.first += b[(i+j)%n]/2;
            now.second ++;
            que.push(now);
        }
        rep(j,0,n){
            pair<ll,ll> now = que.top();
            que.pop();
            //cout<<now.first<<" "<<now.second<<endl;
            count = max(count,now.second);
        }
        ans = min(count,ans);
    }
    print(ans);
    //system("pause");
    return 0;
}
0