https://www.luogu.com.cn/record/124972139 [ABC260B] Better Students Are Needed!
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1010;
struct Student{
int Ma,En,Sc,Id;
}a[MAXN];
bool cmp(Student x,Student y){
if(x.Ma != y.Ma) return x.Ma > y.Ma;
if(x.En != y.En) return x.En > y.En;
if(x.Sc != y.Sc) return x.Sc > y.Sc;
return x.Id < y.Id;
}
signed main(){
int n,x,y,z;cin >> n >> x >> y >> z;
int lu = x + y + z;
for(int i = 1;i <= n;i++){
a[i].Id = i;
cin >> a[i].Ma;
}
for(int i = 1;i <= n;i++){
cin >> a[i].En;
a[i].Sc = a[i].Ma + a[i].En;
}
if(n == 1){
cout << 1 << endl;
return 0;
}
sort(a + 1,a + n + 1,cmp);
for(int i = 1;i <= lu;i++) cout << a[i].Id << endl;
return 0;
}