結果

問題 No.610 区間賞(Section Award)
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2017-12-11 18:43:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 737 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 76,084 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-07 17:08:21
合計ジャッジ時間 4,015 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 RE -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 RE -
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 RE -
testcase_19 AC 12 ms
5,376 KB
testcase_20 AC 50 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 34 ms
5,376 KB
testcase_23 AC 6 ms
5,376 KB
testcase_24 AC 15 ms
5,376 KB
testcase_25 AC 5 ms
5,376 KB
testcase_26 AC 26 ms
5,376 KB
testcase_27 AC 55 ms
5,376 KB
testcase_28 AC 46 ms
5,376 KB
testcase_29 AC 33 ms
5,376 KB
testcase_30 AC 44 ms
5,376 KB
testcase_31 AC 23 ms
5,376 KB
testcase_32 AC 48 ms
5,376 KB
testcase_33 RE -
testcase_34 AC 51 ms
5,376 KB
testcase_35 AC 24 ms
5,376 KB
testcase_36 AC 50 ms
5,376 KB
testcase_37 AC 41 ms
5,376 KB
testcase_38 AC 12 ms
5,376 KB
testcase_39 AC 56 ms
5,376 KB
testcase_40 AC 55 ms
5,376 KB
testcase_41 AC 53 ms
5,376 KB
testcase_42 AC 55 ms
5,376 KB
testcase_43 AC 54 ms
5,376 KB
testcase_44 AC 152 ms
5,376 KB
testcase_45 AC 184 ms
5,376 KB
testcase_46 AC 174 ms
5,376 KB
testcase_47 AC 45 ms
5,376 KB
testcase_48 AC 40 ms
5,376 KB
testcase_49 AC 44 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
    int n;
    vector<int> s,t,ans;
    
    cin >> n;
    
    for(int v, i = 0; i < n; i++) { 
        cin >> v;
        s.push_back(v);
    }
    for(int v, i = 0; i < n; i++) {
        cin >> v;
        t.push_back(v);
    }
    vector<int> w(n);
    for(int v, i = 0; i < n; i++){
        v = s[i];
        w[v] = i;
    }
    
    int j = -1;
    for(int v, i = 0; i < n; i++){
        v = t[i];
        if(w[v] > j){
            ans.push_back(v);
            j = w[v];
        }
    }
    
    sort(ans.begin(), ans.end());
    for(vector<int>::iterator it = ans.begin(); it != ans.end(); it++){
        cout << *it <<endl;
    }
}
0