The Song Dynasty historian Sima Guang in "the Capital Governance Tong Jian" has a famous "The Moral Only Theory": "is therefore only then the virtuous all says the sage, only then the German and the death is the Fool, the German wins only then is said the gentleman, only then wins the moral to be the villain. Whoever takes the technique of the person, Gou not saints, gentleman and with it, with the villain, not if the fool. ”
Now give a number of candidates of the German score, please according to Sima Guang theory to give admission rankings.
Input format:
Enter the 1th line to give 3 positive integers, namely: N (<=105), that is, the total number of candidates, L (>=60), for the admission of the minimum score, that is, the German and want $ are not less than L candidates are eligible to be considered for admission; H (<100), the priority line of admission-- The German and want $ are not below this line is defined as "only de full", such candidates by virtue of the total score from high to low ranking; want $, but the German division to the line of a class of candidates belonging to the "Desheng", but also according to the total number of candidates, but ranked in the first category after the candidate, Germany want $ are lower than H, but the score is not less than want $ candidates belong to "only Germany and death" "De Sheng", ranked by total, but ranked after the second category of candidates, other people who reached the minimum line L were ranked by total, but ranked after the third category of candidates.
Then n lines, each line gives a candidate's information, including: The ticket number, German points, want $, where the ticket number is a 8-bit integer, Germany is divided into the interval [0, 100] integer. The numbers are separated by a space.
Output format:
Output line 1th first gives the number of candidates to reach the minimum fraction m, followed by M, each line in the input format to output a candidate's information, candidates according to the rules indicated in the input from high to low sort. When a certain number of candidates in the same time, according to their German points in descending order; If the German points are also tied, the ticket number in the ascending output.
Input Sample:
14 60 8010000001 64 9010000002 90 6010000011 85 8010000003 85 8010000004 80 8510000005 82 7710000006 83 7610000007 90 7810 000008 75 7910000009 59 9010000010 88 4510000012 80 10010000013 90 9910000014 66 60
Sample output:
1210000013 90 9910000012 80 10010000003 85 8010000011 85 8010000004 80 8510000007 90 7810000006 83 7610000005 82 771000000 2 90 6010000014 66 6010000008 75 7910000001 64 90
Student's study number with int bar, otherwise char or string all error, with printf and scanf bar, otherwise timeout, storage container with vector bar, dynamic relative does not occupy memory.
#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cctype>#include<cstdlib>#include<cmath>#include<string>#include<map>#include<Set>#include<queue>#include<vector>#include<stack>#include<cctype>using namespacestd;typedef unsignedLong Longull;#defineINF 0XFFFFFFFstructstudent{intnum,a,b; };intcmp (student s1,student S2) {if((s1.a+s1.b) = = (s2.a+s2.b)) {if(s1.a==s2.a)returns1.num<S2.num; returnS1.a>s2.a; } return(s1.a+s1.b) > (s2.a+s2.b);}intMain () {intn,x,y,i,j,k; Vector<student>v1,v2,v3,v4; CIN>>n>>x>>y; for(i=0; i<n;++i) {student S; CIN>>s.num>>s.a>>s.b; if(s.a<x| | s.b<x)Continue; if(s.a>=y&&s.b>=y) V1.push_back (s); Else if(s.a>=y&&s.b<y) V2.push_back (s); Else if(s.a<y&&s.b<y&&s.a>=s.b) V3.push_back (s); ElseV4.push_back (s); } sort (V1.begin (), V1.end (), CMP); Sort (V2.begin (), V2.end (), CMP); Sort (V3.begin (), V3.end (), CMP); Sort (V4.begin (), V4.end (), CMP); cout<<v1.size () +v2.size () +v3.size () +v4.size () <<Endl; for(i=0; I!=v1.size (); + +i) printf ("%d%d%d\n", v1[i].num,v1[i].a,v1[i].b); for(i=0; I!=v2.size (); + +i) printf ("%d%d%d\n", v2[i].num,v2[i].a,v2[i].b); for(i=0; I!=v3.size (); + +i) printf ("%d%d%d\n", v3[i].num,v3[i].a,v3[i].b); for(i=0; I!=v4.size (); + +i) printf ("%d%d%d\n", v4[i].num,v4[i].a,v4[i].b); return 0;}
On the pat1015--of morality