题目链接:https://www.luogu.org/problemnew/show/P1583
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
const int maxn=20010;
int E[11];
struct Node{
int w,d,id,e,c;
}a[maxn];
bool cmp1(Node x,Node y){
if(x.w!=y.w) return x.w>y.w;
return x.id<y.id;
}
bool cmp2(Node x,Node y){
if(x.w+E[x.c]!=y.w+E[y.c]) return x.w+E[x.c]>y.w+E[y.c];
return x.id<y.id;
}
int main(void){
int n,k;
cin>>n>>k;
for(int i=1;i<=10;i++) cin>>E[i];
for(int i=1;i<=n;i++){
cin>>a[i].w;
a[i].id=i;
}
sort(a+1,a+n+1,cmp1);
for(int i=1;i<=n;i++){
a[i].d=i;
a[i].c=(i-1)%10+1;
}
sort(a+1,a+n+1,cmp2);
for(int i=1;i<=k;i++){
cout<<a[i].id<<" ";
}
return 0;
}
网友评论