結果

問題 No.9 モンスターのレベル上げ
ユーザー mayoko_mayoko_
提出日時 2014-12-11 16:59:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 454 ms / 5,000 ms
コード長 1,247 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 79,672 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 03:14:54
合計ジャッジ時間 5,505 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 454 ms
4,376 KB
testcase_03 AC 362 ms
4,376 KB
testcase_04 AC 191 ms
4,376 KB
testcase_05 AC 125 ms
4,376 KB
testcase_06 AC 43 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 57 ms
4,376 KB
testcase_09 AC 442 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 379 ms
4,376 KB
testcase_12 AC 294 ms
4,380 KB
testcase_13 AC 209 ms
4,380 KB
testcase_14 AC 444 ms
4,380 KB
testcase_15 AC 401 ms
4,380 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 261 ms
4,380 KB
testcase_18 AC 217 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define INF 1000000000

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MAXN = 2000;
int A[MAXN], B[MAXN];

int main(void) {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    int ans = INF;
    for (int i = 0; i < N; i++) {
        priority_queue<P, vector<P>, greater<P> > que;
        for (int j = 0; j < N; j++) {
            que.push(P(A[j], 0));
        }
        int cnt = 0;
        int cur = i;
        while (cnt < N) {
            P p = que.top(); que.pop();
            p.second++;
            p.first += B[cur] / 2;
            cur = (cur+1) % N;
            cnt++;
            que.push(p);
        }
        int maxNum = 0;
        while (!que.empty()) {
            P p = que.top(); que.pop();
            maxNum = max(maxNum, p.second);
        }
        ans = min(ans, maxNum);
    }
    cout << ans << endl;
    return 0;
}
0