結果

問題 No.610 区間賞(Section Award)
ユーザー TANIGUCHI Kousuke
提出日時 2017-12-11 18:53:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 569 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 66,836 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-30 11:40:10
合計ジャッジ時間 4,118 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 47 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i,n) for(int i = 0; i < n; i++)

int main(void){
    int n;
    cin >> n;

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