結果

問題 No.9 モンスターのレベル上げ
ユーザー h_nosonh_noson
提出日時 2016-06-19 20:05:56
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 275 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 1,470 ms
使用メモリ 3,540 KB
最終ジャッジ日時 2023-01-21 15:45:02
合計ジャッジ時間 4,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,380 KB
testcase_01 AC 1 ms
3,436 KB
testcase_02 AC 275 ms
3,412 KB
testcase_03 AC 220 ms
3,416 KB
testcase_04 AC 115 ms
3,444 KB
testcase_05 AC 76 ms
3,496 KB
testcase_06 AC 27 ms
3,440 KB
testcase_07 AC 2 ms
3,392 KB
testcase_08 AC 35 ms
3,404 KB
testcase_09 AC 269 ms
3,460 KB
testcase_10 AC 1 ms
3,380 KB
testcase_11 AC 206 ms
3,476 KB
testcase_12 AC 185 ms
3,416 KB
testcase_13 AC 137 ms
3,464 KB
testcase_14 AC 271 ms
3,540 KB
testcase_15 AC 243 ms
3,416 KB
testcase_16 AC 6 ms
3,444 KB
testcase_17 AC 157 ms
3,416 KB
testcase_18 AC 130 ms
3,468 KB
testcase_19 AC 3 ms
3,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;

#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)

typedef long long ll;

int main(void) {
    int i, n;
    int a[1500], b[1500];
    cin >> n;
    rep (i,n) cin >> a[i];
    rep (i,n) cin >> b[i];

    int s, ans = INF;
    rep (s,n) {
        int count = 0;
        priority_queue<pair<int,int>> q; // (-level,-count)
        rep (i,n) q.push(make_pair(-a[i],0));
        rep (i,n) {
            auto p = q.top();
            q.pop();
            p.first -= b[(s+i)%n]/2;
            p.second--;
            count = max(count,-p.second);
            q.push(p);
        }
        ans = min(count,ans);
    }
    cout << ans << endl;
    return 0;
}
0