結果

問題 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,414 ms
コンパイル使用メモリ 149,272 KB
実行使用メモリ 5,060 KB
最終ジャッジ日時 2023-08-21 09:06:19
合計ジャッジ時間 6,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 11 ms
4,380 KB
testcase_20 AC 52 ms
4,496 KB
testcase_21 AC 8 ms
4,376 KB
testcase_22 AC 35 ms
4,376 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 14 ms
4,380 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 24 ms
4,380 KB
testcase_27 AC 51 ms
4,728 KB
testcase_28 AC 45 ms
4,384 KB
testcase_29 AC 33 ms
4,380 KB
testcase_30 AC 43 ms
4,376 KB
testcase_31 AC 22 ms
4,376 KB
testcase_32 AC 48 ms
4,424 KB
testcase_33 AC 8 ms
4,384 KB
testcase_34 AC 51 ms
4,512 KB
testcase_35 AC 25 ms
4,376 KB
testcase_36 AC 49 ms
4,556 KB
testcase_37 AC 42 ms
4,376 KB
testcase_38 AC 12 ms
4,380 KB
testcase_39 AC 53 ms
4,800 KB
testcase_40 AC 53 ms
4,552 KB
testcase_41 AC 53 ms
4,504 KB
testcase_42 AC 53 ms
4,632 KB
testcase_43 AC 53 ms
4,504 KB
testcase_44 AC 159 ms
4,696 KB
testcase_45 AC 189 ms
5,060 KB
testcase_46 AC 190 ms
4,956 KB
testcase_47 AC 44 ms
4,380 KB
testcase_48 AC 41 ms
4,452 KB
testcase_49 AC 45 ms
4,380 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