Overtakings (g1)

211 teams scored 12234 points on this task, for a maximum score of 100, an average score of 58 and a median score of 38.

Highlights

  1. Banfi, Vimercate is the institute with the most points (400).
  2. Lombardia is the region with the most points (2298).

Statement

You are watching a Formula 1 race, and you know that there are N drivers who are participating in the race. Each driver's car has a distinct number from 1 to N. At first, you are given the starting order of the cars, described by an array of N values: at position i we have the car numbered C_i. You also know that there were Q overtakings which took place during the race, each of them indicated by an integer X: car number X is overtaking the car in front of them. For example, if we have the array C = [2, 3, 1], the car number 2 is leading the race, and car 1 is at the back. After the query "3" the array becomes [3, 2, 1]; here 2 is overtaken by 3. For each operation print the car number that is overtaken the highest number of times after all the operations made so far. If there are more such cars, print the one with the smallest number.