Predicting Terrain and Wins in a Racing Tournament
Given the rank lists of each racer on three terrains, predict how many races will happen on each terrain and the wins of each racer.
Example 1:
Input:3 1 2 3 3 2 1 2 3 1
Output:2 1 0 2 0 1
Example 2:
Input:4 1 3 2 4 4 2 3 1 1 3 2 4
Output:4 2 0 3 0 1 2
Constraints:
The input contains N space-separated integers for each terrain, where N is the number of racers.
The rank lists are 1-indexed, meaning the first racer is ranked 1 and the last racer is ranked N.
The output contains three integers representing the number of races on each terrain, followed by N space-separated integers representing the wins of each racer.
solution.cpp
Loading...
Run code to see test results
00:00 / 69:42
Predicting Terrain and Wins in a Racing Tournament
MediumMed•364 views
Given the rank lists of each racer on three terrains, predict how many races will happen on each terrain and the wins of each racer.
Example 1:
Input:3 1 2 3 3 2 1 2 3 1
Output:2 1 0 2 0 1
Example 2:
Input:4 1 3 2 4 4 2 3 1 1 3 2 4
Output:4 2 0 3 0 1 2
Constraints:
The input contains N space-separated integers for each terrain, where N is the number of racers.
The rank lists are 1-indexed, meaning the first racer is ranked 1 and the last racer is ranked N.
The output contains three integers representing the number of races on each terrain, followed by N space-separated integers representing the wins of each racer.