結果

問題 No.9 モンスターのレベル上げ
ユーザー tottoripapertottoripaper
提出日時 2014-11-16 03:12:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,038 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 47,976 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-30 07:06:22
合計ジャッジ時間 5,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 197 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <vector>
#include <queue>

#define mp std::make_pair

typedef std::pair<int,int> P;
typedef std::pair<P, int> State;

int main(){
    int N;
    scanf("%d", &N);

    int A[1500], B[1500];
    for(int i=0;i<N;i++){scanf("%d", A+i);}
    for(int i=0;i<N;i++){scanf("%d", B+i);}
    
    int res = 0;
    for(int first=0;first<N;first++){
        int counter[1500];
        std::fill(counter, counter+1500, 0);

        std::priority_queue<State, std::vector<State>, std::greater<State>> q;
        for(int i=0;i<N;i++){q.push(mp(mp(A[i], 0), i));}

        for(int i=0;i<N;i++){
            State s = q.top(); q.pop();
            int index = (first+i) % N;
            
            q.push(mp(mp(s.first.first+B[index], s.first.second+1), s.second));
            counter[s.second] += 1;
        }

        int mx = 0;
        for(int i=0;i<N;i++){
            mx = std::max(mx, counter[i]);
        }

        res = std::max(res, mx);
    }

    printf("%d\n", res);
}
0