結果

問題 No.9 モンスターのレベル上げ
ユーザー momoyuu
提出日時 2022-08-24 00:45:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 477 ms / 5,000 ms
コード長 1,475 bytes
コンパイル時間 3,208 ms
コンパイル使用メモリ 254,464 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 06:57:10
合計ジャッジ時間 7,974 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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