[Description]
The selection of volunteers for the Expo is in full swing in City. In order to select the most suitable talent, City A has performed a written examination on all contestants who have registered. Only contestants whose scores have reached the interview score can enter the interview. The interview score is based on 150% of the number of students enrolled. That is, if you plan to enroll M volunteers, the interview score is the score of the contestant ranking M * 150% (rounded down, the final contestants who enter the interview are all contestants whose written examination scores are no less than the Interview Score.
Write it nowProgramDefine the interview scores and output the registration numbers and test scores of all contestants entering the interview.
[Input format]
The first line contains two integers, N and M (5 ≤ n ≤, 3 ≤ m ≤ n), separated by a space. N indicates the total number of contestants who have registered for the test, M indicates the number of volunteers to be admitted. Input data must be M * 150% rounded down and less than or equal to n.
Line 2 to line n + 1, each line contains two integers separated by a space, respectively, the contestant's registration number K (1000 ≤ k ≤ 9999) and the contestant's test score S (1 ≤ S ≤ 100 ). Data ensures that contestants have different registration numbers.
[Output format]
The first line has two integers separated by a space. The first integer represents the Interview Score Line. The second integer represents the actual number of contestants who enter the interview.
Starting from the second line, each line contains two integers separated by a space in the middle, indicating the contestant's registration number and written test score, respectively, according to the written test score from high to low, if the score is the same, it is output in the order of the registration number from small to large.
[Input example]
6 3
1000 90
3239 88
2390 95
7231 84
1005 95
1001 88
[Output example]
88 5
1005 95
2390 95
1000 90
1001 88
3239 88
[Analysis]
It is easy to simulate according to the description of the question.
# Include <stdio. h> # include <stdlib. h> # include <math. h> # define maxn 5010 struct SS {int num, mark;} A [maxn], ANS [maxn]; int n, m, O, TOT; int CMP (const void * a, const void * B) {SS c = * (SS *) A, D = * (SS *) B; If (C. mark> D. mark) Return-1; if (C. mark <D. mark) return 1; if (C. num <D. num) Return-1; if (C. num> D. num) return 1; return 0;} int main () {freopen ("score. in "," r ", stdin); freopen (" socret. out "," W ", stdout); scanf (" % d ", & N, & M); double F = m; F = floor (F * 1.5 ); O = (INT) F; For (INT I = 0; I <n; ++ I) scanf ("% d", & A [I]. num, & A [I]. mark); qsort (A, N, sizeof (SS), CMP); For (INT I = 0; I <O; ++ I) ans [++ tot] = A [I]; M = O; while (A [M]. mark = A [O-1]. mark) {ans [++ tot] = A [m]; ++ m;} printf ("% d \ n", a [O-1]. mark, TOT); For (INT I = 1; I <= tot; ++ I) printf ("% d \ n", ANS [I]. num, ANS [I]. mark); Return 0 ;}