結果

問題 No.610 区間賞(Section Award)
ユーザー ミドリムシミドリムシ
提出日時 2017-12-10 00:14:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 823 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 75,220 KB
実行使用メモリ 4,940 KB
最終ジャッジ日時 2023-08-20 05:33:43
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 11 ms
4,376 KB
testcase_20 AC 51 ms
4,452 KB
testcase_21 AC 8 ms
4,376 KB
testcase_22 AC 34 ms
4,380 KB
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 13 ms
4,376 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 24 ms
4,376 KB
testcase_27 AC 50 ms
4,460 KB
testcase_28 AC 45 ms
4,500 KB
testcase_29 AC 32 ms
4,376 KB
testcase_30 AC 43 ms
4,380 KB
testcase_31 AC 22 ms
4,380 KB
testcase_32 AC 48 ms
4,392 KB
testcase_33 AC 8 ms
4,376 KB
testcase_34 AC 51 ms
4,508 KB
testcase_35 AC 25 ms
4,380 KB
testcase_36 AC 49 ms
4,380 KB
testcase_37 AC 41 ms
4,376 KB
testcase_38 AC 12 ms
4,380 KB
testcase_39 AC 52 ms
4,436 KB
testcase_40 AC 53 ms
4,512 KB
testcase_41 AC 52 ms
4,492 KB
testcase_42 AC 53 ms
4,476 KB
testcase_43 AC 53 ms
4,464 KB
testcase_44 AC 149 ms
4,756 KB
testcase_45 AC 185 ms
4,940 KB
testcase_46 AC 185 ms
4,756 KB
testcase_47 AC 44 ms
4,376 KB
testcase_48 AC 41 ms
4,380 KB
testcase_49 AC 44 ms
4,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin >> N;
    int start_ranking[N];
    for(int i = 0; i < N; i++){
        cin >> start_ranking[i];
    }
    int goal_ranking[N];
    int player_goal_rank[N];
    for(int i = 0; i < N; i++){
        cin >> goal_ranking[i];
        player_goal_rank[goal_ranking[i] - 1] = i;
    }
    vector<int> answers;
    int goal_fastest_rank = N;
    for(int i = N - 1; i >= 0; i--){
        if(goal_fastest_rank > player_goal_rank[start_ranking[i] - 1]){
            answers.push_back(start_ranking[i]);
            goal_fastest_rank = player_goal_rank[start_ranking[i] - 1];
        }
    }
    sort(answers.begin(), answers.end());
    for(int i = 0; i < answers.size(); i++){
        cout << answers[i] << endl;
    }
}
0