結果

問題 No.9 モンスターのレベル上げ
ユーザー gaokai2050gaokai2050
提出日時 2022-11-10 09:44:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 431 ms / 5,000 ms
コード長 747 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 170,340 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 18:59:50
合計ジャッジ時間 6,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 431 ms
4,380 KB
testcase_03 AC 344 ms
4,376 KB
testcase_04 AC 181 ms
4,380 KB
testcase_05 AC 118 ms
4,380 KB
testcase_06 AC 40 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 53 ms
4,380 KB
testcase_09 AC 419 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 358 ms
4,380 KB
testcase_12 AC 277 ms
4,376 KB
testcase_13 AC 180 ms
4,376 KB
testcase_14 AC 420 ms
4,376 KB
testcase_15 AC 383 ms
4,376 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 244 ms
4,376 KB
testcase_18 AC 204 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;    
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(int i=0;i<(n);i++)
int n,a[3010],b[3010],ans=1e9;
priority_queue<pii> pq;
int main() {
    cin>>n;
    for (int i=1;i<=n;++i) cin>>a[i],a[n+i]=a[i];
    for (int i=1;i<=n;++i) cin>>b[i],b[n+i]=b[i];
    for (int i=1;i<=n;++i) {
        for (int j=1;j<=n;++j) pq.push(make_pair(-a[j],0));
        for (int j=i;j<i+n;++j) {
            pii p=pq.top(); pq.pop();
            p.first-=b[j]/2;
            p.second-=1;
            pq.push(p);
        }
        int mx=0;
        while (!pq.empty()) {
            mx=max(mx,-pq.top().second); pq.pop();
        }
        if (mx<ans) ans=mx;
    }
    cout<<ans<<endl;
    return 0;
}
0