結果

問題 No.610 区間賞(Section Award)
ユーザー ikd
提出日時 2017-12-10 00:24:36
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 1,704 ms
コンパイル使用メモリ 147,708 KB
実行使用メモリ 12,380 KB
最終ジャッジ日時 2024-06-12 22:57:57
合計ジャッジ時間 4,467 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

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[]);

  bool[int] vis;
  int i=0; int[] c;
  for(int j=0; j<n; j++){
    if(b[j] in vis) continue;
    while(i<n && a[i]!=b[j]) vis[a[i]]=true, i++;
    c~=b[j];
  }

  sort(c);
  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;
}
0