B - Better Students Are Needed!
Problem Statement
NN examinees took an entrance exam.
The examinee numbered ii scored A_iAi points in math and B_iBi points in English.
The admissions are determined as follows.
- XX examinees with the highest math scores are admitted.
- Then, among the examinees who are not admitted yet, YY examinees with the highest English scores are admitted.
- Then, among the examinees who are not admitted yet, ZZ examinees with the highest total scores in math and English are admitted.
- Those examinees who are not admitted yet are rejected.
Here, in each of the steps 1. to 3., ties are broken by examinees' numbers: an examinee with the smaller examinee's number is prioritized. See also Sample Input and Output.
Print the examinees' numbers of the admitted examinees determined by the steps above in ascending order, separated by newlines.
Constraints
- All values in input are integers.
- 1 \le N \le 10001≤N≤1000
- 0 \le X,Y,Z \le N0≤X,Y,Z≤N
- 1 \le X+Y+Z \le N1≤X+Y+Z≤N
- 0 \le A_i,B_i \le 1000≤Ai,Bi≤100
Input
Input is given from Standard Input in the following format:
NN XX YY ZZ A_1A1 A_2A2 \dots… A_NAN B_1B1 B_2B2 \dots… B_NBN
Output
Print the examinees' number of the admitted examinees in ascending order, separated by newlines.
Sample Input 1 Copy
6 1 0 2 80 60 80 60 70 70 40 20 50 90 90 80
Sample Output 1 Copy
1 4 5
结构体的使用
找出最大n个数字的
#include
int main()
{int n,x,y,z;scanf("%d %d %d %d",&n,&x,&y,&z);int a[1002],b[1002];int i;for(i=1;i<=n;i++){scanf("%d",&a[i]);}for(i=1;i<=n;i++){scanf("%d",&b[i]);}int j,dz[1002],k=0,max,dZ;while(x--){//找出最大X个数字//for(i=1;idz[j+1]){int t; t=dz[j];dz[j]=dz[j+1];dz[j+1]=t;}}}for(i=0;i
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
