Snowman
InterviewTime limit1sMemory limit1024 MB
Given two rankings of the same players, find the bib numbers that rose the most places, listed in their final rank order.
- Level
Easy2 of 10
- Topics
- Hash map, Implementation
- Solved
- No attempts yet
Problem
The snowman-making event at the Pyeongchang Winter Olympics has started! In this event, the person who builds the biggest snowman within the given time wins.
Ari turned on the broadcast when the event had only just started. The broadcast was showing the leaderboard, a table that lists each player's bib number in rank order. Ari memorized the bib numbers on the leaderboard in order.
Ari stepped away for a moment, and the event ended. Given the leaderboard at the end of the event, find the bib numbers of the players whose rank rose the most compared to the ranks Ari remembered.
Input
The first line contains the number of players .
The second line contains integers , the bib numbers of each player in rank order when Ari turned on the broadcast, separated by spaces.
The third line contains integers , the bib numbers of each player in rank order at the end of the event, separated by spaces.
Output
Print the bib numbers of the players whose rank rose the most, in the order of their rank at the end of the event, separated by spaces.
Constraints
- All are distinct. ()
- All are distinct. ()
- The set of elements of array is the same as the set of elements of array .