https://www.luogu.org/problem/P1583
话不多说,其实就是模拟,然后,各种繁琐
#include<bits/stdc++.h> using namespace std; struct st { int bianhao; int w; int d; int c; int zong; } stu[20005]; bool cmp1(st a,st b) { if(a.w==b.w) return a.bianhao<b.bianhao; return a.w>b.w; } bool cmp2(st a,st b) { if(a.zong==b.zong) return a.bianhao<b.bianhao; return a.zong>b.zong; } int main() { int n,k; cin>>n>>k; int E[11],W[20005]; for(int i=1; i<=10; i++) cin>>E[i]; for(int i=1; i<=n; i++) cin>>W[i]; for(int i=1; i<=n; i++) { stu[i].bianhao=i; stu[i].w=W[i]; } sort(stu+1,stu+1+n,cmp1); for(int i=1; i<=n; i++) { stu[i].d=i; stu[i].c=(stu[i].d-1)%10+1; stu[i].zong=E[stu[i].c]+stu[i].w; } sort(stu+1,stu+1+n,cmp2); for(int i=1; i<=k; i++) { cout<<stu[i].bianhao<<" "; } return 0; }