結果

問題 No.610 区間賞(Section Award)
ユーザー たこしたこし
提出日時 2017-12-16 11:23:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 162,600 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-08 14:24:00
合計ジャッジ時間 5,310 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 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 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 52 ms
5,376 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 36 ms
5,376 KB
testcase_23 AC 6 ms
5,376 KB
testcase_24 AC 14 ms
5,376 KB
testcase_25 AC 4 ms
5,376 KB
testcase_26 AC 25 ms
5,376 KB
testcase_27 AC 53 ms
5,376 KB
testcase_28 AC 46 ms
5,376 KB
testcase_29 AC 33 ms
5,376 KB
testcase_30 AC 43 ms
5,376 KB
testcase_31 AC 22 ms
5,376 KB
testcase_32 AC 48 ms
5,376 KB
testcase_33 AC 8 ms
5,376 KB
testcase_34 AC 51 ms
5,376 KB
testcase_35 AC 25 ms
5,376 KB
testcase_36 AC 50 ms
5,376 KB
testcase_37 AC 42 ms
5,376 KB
testcase_38 AC 13 ms
5,376 KB
testcase_39 AC 54 ms
5,376 KB
testcase_40 AC 53 ms
5,376 KB
testcase_41 AC 52 ms
5,376 KB
testcase_42 AC 52 ms
5,376 KB
testcase_43 AC 55 ms
5,376 KB
testcase_44 AC 152 ms
5,376 KB
testcase_45 AC 180 ms
5,376 KB
testcase_46 AC 190 ms
5,376 KB
testcase_47 AC 45 ms
5,376 KB
testcase_48 AC 43 ms
5,376 KB
testcase_49 AC 44 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using LL = long long int;

const int MAX_N = 100005;

int N;
int A[MAX_N], B[MAX_N];
int AIndex[MAX_N];

int main()
{
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    AIndex[A[i]] = i;
  }
  for(int i = 0; i < N; i++) {
    cin >> B[i];
  }


  int ansIndex = 0;
  vector<int> ansList;
  for(int i = 0; i < N; i++) {
    if(AIndex[B[i]] < ansIndex) {
      continue;
    } else {
      ansIndex = AIndex[B[i]];
      ansList.push_back(B[i]);
    }
  }

  sort(begin(ansList), end(ansList));
  for(int ans : ansList) {
    cout << ans << endl;
  }

  return 0;
}
0