結果

問題 No.610 区間賞(Section Award)
ユーザー face4
提出日時 2018-12-24 22:37:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 72,644 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-09-25 11:02:57
合計ジャッジ時間 5,749 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set>
using namespace std;

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

    int a[n], b[n], x;
    for(int i = 0; i < n; i++)  cin >> x, a[--x] = i;
    for(int i = 0; i < n; i++)  cin >> b[i], b[i]--;

    set<int> s, res;
    s.insert(-1);    // sentinel
    for(int i = 0; i < n; i++){
        if(*(--(s.end())) < a[b[i]])    res.insert(b[i]);
        s.insert(a[b[i]]);
    }

    for(int x : res)    cout << x+1 << endl;

    return 0;
}
0