Formula One Race (formula1)

38 teams scored 1475 points on this task, for a maximum score of 100, an average score of 39 and a median score of 25.

Highlights

  1. Galileo Ferraris, Molfetta is the institute with the most points (165).
  2. Emilia-Romagna is the region with the most points (310).

Statement

Matthew is a die-hard fan of Formula One (also known as Formula 1 or F1) and an outstanding programmer. As he watched an F1 race with N cars, he found some strange patterns. Mainly, he observed that the distance traveled by the car with number i after t seconds from the start is equal to a_i * t^2 + b_i * t + c_i. Matthew decided to implement a website with a scoreboard, where any F1 fan can see which car occupies a certain position at a certain moment. The position of a pilot is related to the distance it traveled, more distance meaning a better place (i.e. the first car traveled the most, the second car traveled the second most, and so on). If two cars travel the same distance, the lower car number is ahead. There are Q visitors to Matthew's website, each visitor asks for the car number of the pilot occupying the p-th position at the instant t. As Matthew is busy watching the races, he asks you to help him answer each visitor query.