Company: Flipkart_24dec
Difficulty: medium
Racing Tournament Racing Tournament Problem Description A racing tournament is happening, and racers from various backgrounds have come to participate. There are three racing terrains: 1. Hilly terrain 2. City Race 3. Off-Roading For each terrain, the racers are ranked based on their expertise. The strongest racer has rank 1. A racer with a lower rank always beats a racer with a higher rank on that specific terrain. The tournament is in a round-robin format, i.e., each contestant races once against all other contestants. Since two racers compete only once, the choice of terrain becomes very important. To make the tournament exciting, the terrain for each race is selected by the organizers based on the following ranking lists and rules: Each race should be raced on the terrain in which the winner would be the strongest (i.e., the winner must have the lowest rank in the corresponding rank list). In case of a tie in the winner's rank (e.g., racer 1 wins on Hilly terrain with rank 1, and r