Canadian Computing Olympiad: 2017 Day 2, Problem 2
Kevin is developing his professional network within a certain community. Unfortunately, he has not connected with anybody yet. But he has his eyes on
However, few people in this community are willing to friend an outsider. Each of the
Kevin likes his Internet Points very much, and so he doesn't want to give away too many. Now it is your job to help Kevin give away the least number of Internet Points while still making connections with each of the
Input Specification
The first line will contain the integer
For 2 of the 25 available marks,
For an additional 4 of the 25 available marks,
For an additional 7 of the 25 available marks,
Output Specification
Output one integer on a single line, the minimum number of Internet Points Kevin has to give away.
Sample Input 1
4
3 3
1 2
0 5
3 4
Sample Output 1
3
Explanation for Sample 1
Kevin can connect with person
Sample Input 2
5
0 9
1 8
2 7
3 6
4 5
Sample Output 2
0
Explanation for Sample 2
It is possible that Kevin can connect with everyone without giving away any Internet Points.
Sample Input 3
3
0 6
2 7
3 8
Sample Output 3
8
Explanation for Sample 3
Kevin should connect with person
Comments