International Olympiad in Informatics (IOI)
Time limit1sMemory limit1024 MB
Given each contestant's partial total, decide who is guaranteed a gold medal and who still has a chance, using the rule that gold goes to the top 1/12 of contestants by final total.
- Level
Medium6 of 10
- Topics
- Sorting, Greedy, Math, Implementation
- Solved
- No attempts yet
Problem
In 20XX, the IOI is finally held in the country of JOI, and K contestants take part. The contestants are numbered 1, 2, ..., K. There are N problems in total, and each contestant receives an integer score between 0 and 100 inclusive for each problem.
Contestants receive medals according to their total score over the N problems. The exact conditions for awarding medals are fixed, for example for gold medals, as follows.
Let G be the largest value such that the number of contestants whose total score over the N problems is at least G is at least 1/12 of all contestants. Then the condition for receiving a gold medal is that the total score over the N problems is at least G.
M problems have already finished and their scores are fixed. Looking at each contestant's current total score on the IOI website, you want to know how many contestants are certain to receive a gold medal and how many could possibly receive one.
Given each contestant's current total score, write a program that outputs the contestants who are certain to receive a gold medal and the contestants who could possibly receive one, each in increasing order of number.
Input
Read the following input from standard input.
- The first line contains the integers K, N, M separated by spaces: the number of contestants is K, the total number of problems is N, and M of them have already finished.
- The following K lines give each contestant's score. The (i + 1)-th line (1 ≤ i ≤ K) contains the integer Pi, the current total score of contestant number i.
Output
Print the following to standard output.
- The first a lines must list the numbers of the contestants who are certain to receive a gold medal, one per line, in increasing order. Here a is the number of contestants certain to receive a gold medal.
- The next line must contain the string
--------(eight hyphens). - The following b lines must list the numbers of the contestants who could possibly receive a gold medal, one per line, in increasing order. Here b is the number of contestants who could possibly receive a gold medal.
Constraints
- 1 ≤ K ≤ 100 000 number of contestants
- 1 ≤ N ≤ 10 000 000 total number of problems
- 0 ≤ M ≤ N number of problems already finished
- 0 ≤ Pi ≤ 100 × M current total score of contestant number i