結果
| 問題 | No.610 区間賞(Section Award) | 
| コンテスト | |
| ユーザー |  ikd | 
| 提出日時 | 2017-12-11 00:31:23 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 69 ms / 2,000 ms | 
| コード長 | 682 bytes | 
| コンパイル時間 | 1,690 ms | 
| コンパイル使用メモリ | 147,296 KB | 
| 実行使用メモリ | 7,560 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:58:14 | 
| 合計ジャッジ時間 | 4,001 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 50 | 
ソースコード
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  int n; rd(n);
  auto a=readln.split.to!(int[]);
  auto b=readln.split.to!(int[]);
  a.each!"a--"; b.each!"a--";
  auto vis=new bool[](n);
  int i=0; int[] c;
  for(int j=0; j<n; j++){
    if(vis[b[j]]) continue;
    while(i<n && a[i]!=b[j]) vis[a[i]]=true, i++;
    c~=b[j];
  }
  sort(c); c.each!"a++";
  writefln("%(%s\n%)", c);
}
void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) stderr.write(e, " ");
  stderr.writeln;
}
            
            
            
        