TheOlympiadInInformatics
TCO13 Round 1C · 2013-02-19 · by Vasyl[alphacom]
Problem Statement
You are given a
Constraints
- sums will contain between 1 and 47 elements, inclusive.
- Each element of sums will be between 0 and 1,000,000,000, inclusive.
- k will be between 0 and 1,000,000,000, inclusive.
{4, 7, 0, 5}
0
Returns: 7
John has to gain at least 7 points, because there might be a competitor with 7 points in room number 1 (0-based index).
{4, 7}
2
Returns: 3
It is possible that there are three contestants who scored more than 2 points: there can be one in room 0 and two more in room 1. There can only be at most two contestants who scored more than 3 points: there can be at most one such contestant in each of the two rooms. (Note that the score of each contestant has to be an integer.) Therefore, John has to score at least 3 points.
{999999999}
1000000000
Returns: 0
Here it is enough to gain 0 points.
{95, 23, 87, 23, 82, 78, 59, 44, 12}
70
Returns: 6
{31}
99
Returns: 0
Submissions are judged against all 169 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class TheOlympiadInInformatics with a public method int find(vector<int> sums, int k) · 169 test cases · 2 s / 256 MB per case