RaceTrack
TCO07 Round 1C · 2007-03-07 · by Mike Mirzayanov
Problem Statement
A race track is represented as a line segment. You are given its length, and a
You are given an
Constraints
- length will be between 1 and 1000000, inclusive.
- pos will contain between 2 and 50 elements, inclusive.
- Each element of pos will be greater than the previous, if it exists.
- Each element of pos will be between 0 and length, inclusive.
- judges will be between 2 and number of elements in pos, inclusive.
11
3
{0, 5, 10, 11}
Returns: "1110"
Another solution that maximizes the distance between the two closest judges is "1101", but it is not the lexicographically latest.
11
2
{0, 5, 10, 11}
Returns: "1001"
The distance between the two judges should be as large as possible.
11
4
{0, 5, 10, 11}
Returns: "1111"
The judges do not have any choice.
1000
5
{6, 9, 33, 59, 100, 341, 431, 444, 565, 857}
Returns: "1000010111"
1
2
{0, 1}
Returns: "11"
Submissions are judged against all 118 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class RaceTrack with a public method string judgePositions(int length, int judges, vector<int> pos) · 118 test cases · 2 s / 256 MB per case