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<stdio.h>
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;i<n;i++){max=1;for(j=2;j<=n;j++){if(a[max]<a[j])max=j;//存储最大数字的下标号}dz[k++]=max;a[max]=-1,b[max]=-1;//这个值去除掉//}}while(y--){//for(i=1;i<n;i++){max=1;for(j=2;j<=n;j++){if(b[max]<b[j])max=j;}dz[k++]=max;a[max]=-1,b[max]=-1;//}}while(z--){//for(i=1;i<n;i++){max=1;for(j=2;j<=n;j++){if(a[max]+b[max]<a[j]+b[j])max=j;}dz[k++]=max;a[max]=-1,b[max]=-1;//}}for( i=0;i<k-1;i++){for(j=0;j<k-i-1;j++){if(dz[j]>dz[j+1]){int t; t=dz[j];dz[j]=dz[j+1];dz[j+1]=t;}}}for(i=0;i<k;i++)printf("%d\n",dz[i]);return 0;
}
B - Better Students Are Needed!相关推荐
- AtCoder Beginner Contest 260 A~F 题解
ABC260 A~F [A - A Unique Letter](https://atcoder.jp/contests/abc260/tasks/abc260_a) 题目大意 输入格式 输出格式 样 ...
- libc.so.6 is needed by mysql_libc.so.6(GLIBC_2.14)(64bit) is needed by…问题的解决办法
在使用Linux服务器过程中,是否有遇到过"libc.so.6(GLIBC_2.14)(64bit) is needed by-"的问题,像小编就遇到了类似的问题: 安装rpm - ...
- 解决:Error: Insufficient values in manual scale. 5 needed but only 4 provided.Run `rlang::last_error()
解决:Error: Insufficient values in manual scale. 5 needed but only 4 provided.Run `rlang::last_error() ...
- HDU 2444 The Accomodation of Students (二部图+染色)
The Accomodation of Students Time Limit : 5000/1000ms (Java/Other) Memory Limit : 32768/32768K (Ja ...
- libc.so.6(GLIBC_2.14)(64bit) is needed by...问题的解决办法
在使用Linux服务器过程中,是否有遇到过"libc.so.6(GLIBC_2.14)(64bit) is needed by..."的问题,像小编就遇到了类似的问题: 安装rpm ...
- pythreejs is needed for plotting with pythreejs backend
pythreejs is needed for plotting with pythreejs backend 找到代码: https://github.com/daavoo/pyntcloud/bl ...
- to make target ‘../../lib/aaaaa.so‘, needed by ‘ xxx ‘
ndk编译报错: to make target '../../lib/aaaaa.so', needed by ' xxx ' 我这原因是lib下缺少文件 aaaaa.so 解决方法: 找到aaaaa ...
- one of the variables needed for gradient computation has been modified by an inplace operation
参考:https://www.cnblogs.com/liangzp/p/9207979.html 使用一个pytorch写的模型时,报错:RuntimeError:one of the variab ...
- one of the variables needed for gradient computation has been modified by an inplace
one of the variables needed for gradient computation has been modified by an inplace 参考:https://blog ...
最新文章
- 使用javascript模拟常见数据结构(二)
- AWS工具boto3使用笔记
- 一文带你了解 FPGA
- 借助亚马逊S3和RapidMiner将机器学习应用到文本挖掘
- ie8以下 es5常见的数组遍历方法不可用的解决方案 forEach,map,filter,some,every
- C# 托管资源和非托管资源(Dispose、析构函数)
- git 命令行(一)-版本回退
- SAP License:创建新的库存地点
- cocos2dx对于强大的RichText控制
- vscode不能跳转_vscode-goto-node-modules 一个快速定位 node 模块的 vscode 插件
- 算法的优缺点_朴素贝叶斯算法的优缺点
- 完善的IaaS云服务的个人理解
- Mac安装MySQL8碰到的问题
- 2020软考论文想要拿高分,要避开这些坑!
- Unity之UnityWebRequest和使用
- 计算机系统内部存储器的存储单元,内部存储器练习
- 什么是beacons - 在Web Analytics中的应用(网站分析的灯塔)
- varnish 高性能加速器
- 如何查看自己电脑应该买什么样的内存条
- micropython 常量_MicroPython添加Module(二)