結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー 👑 ONPU3
提出日時 2026-10-16 22:36:11
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 286 ms / 5,000 ms
+ 458µs
コード長 741 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,420 ms
コンパイル使用メモリ 344,020 KB
実行使用メモリ 9,792 KB
最終ジャッジ日時 2026-10-16 22:36:21
合計ジャッジ時間 6,729 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;cin>>n;
    vector<ll>a(n),b(n);
    for(auto&o:a)cin>>o;
    for(auto&o:b)cin>>o;
    ll ans=1LL<<60;
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<>>que;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)que.push({a[j],0});
        for(int j=0;j<n;j++)
        {
            auto[level,count]=que.top();
            que.pop();
            que.push({level+b[(i+j)%n]/2,count+1});
        }
        ll now=0;
        while(!que.empty())
        {
            now=max(now,que.top().second);
            que.pop();
        }
        ans=min(ans,now);
    }
    cout<<ans<<endl;
}
0