結果

問題 No.610 区間賞(Section Award)
ユーザー YosukeKawada
提出日時 2018-01-15 10:11:28
言語 Ruby
(3.4.1)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 51,584 KB
最終ジャッジ日時 2024-12-24 02:33:23
合計ジャッジ時間 10,182 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = $stdin.gets.chomp.to_i
S = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
T = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }

runner = Hash[T.map.with_index{ |n,i| [n, { t: i+1 }] }]

preliminary_head = N+1
ans = []

S.reverse.each{ |n|
  if runner[n][:t] < preliminary_head
    ans << n
  end
  preliminary_head = [preliminary_head, runner[n][:t]].min
}

puts ans.sort

0