sir if we have vectors of pair and we need to sort but we also need to main index how we do that?
for example:
Imagine a pandemic situation that happened in the middle of a session and results in an immediate closure of offline education. In such a scenario universities have to come up with some solution so as to finish with the evaluation process of the current semester. They decided to end the semester not by giving grades based on marks, instead proposed to just declare if a student has passed the subject or not.
The process they adopted is as detailed here. As its mid of the running semester each subject has already finished with a few of the sessional components comprising of some marks out of the maximum marks in that subject. In addition, the maximum marks that can be scored in a subject may vary from one subject to another. Therefore, each subject has to decide the minimum marks, say MINMARKS, which should be greater than the total marks of the sessional components that are completed by now in offline mode for the subject. Every student has to score at least MINMARKS to pass that subject. Once decided, for each subject, inform students about the MINMARKS and also declare the marks obtained in the sessional finished so far.
One assignment per subject is given to students so that they can score the remaining marks. The pattern of the assignment remains same for all the subjects. An assignment consists of a set of questions and students are free to attempt as many questions as they want, i.e. all questions are not mandatory. Each assignment question has a maximum score and some number of sub-parts. The difficulty level of a question is based on the following criteria:
More is the number of sub-parts easier is the question irrespective of the maximum score of that question.
In case two or more questions have same number of sub-parts then difficulty level is decided via ratio of maximum score and number of sub-parts. Lesser is the ratio easier is the question.
Knowing the assignment pattern and the fact that one just has to score MINMARKS, students decided to score only the remaining marks by selecting the easiest assignment questions. You have to help these students in this selection by proposing the strategy to be followed.
Input:
Line 1 contains three space separated integers MINMARKS, S, and N, i.e. minimum marks to pass the subject, total number of students, and total number of assignment questions, respectively.
Line 2 contains S integers separated by space. These are the sessional marks of S students.
Following N lines contain space separated 2 integers, representing the maximum score and the number of sub-parts in a question.
Output:
There will be S lines in the output. The first number in each line, say x, represents the count of questions a student has to attempt to score at least MINMARKS. It is followed by space separated x integers, sorted in increasing order, representing the question numbers to be attempted.
Constraints
All values range in between 1 and 1000.
Sample Input:
75 3 5
15 50 35
6 3
11 1
13 4
27 1
18 2
Sample Output:
5 1 2 3 4 5
3 1 3 5
4 1 2 3 5