【Vijos1282】佳佳的魔法照片

problem

solution

codes

#include<iostream>
#include<algorithm>
using namespace std;
struct peo{ int w, id; }hum[50010];
bool cmp(peo a, peo b){ return a.w==b.w?a.id<b.id:a.w>b.w; };
int e[50010];
int main(){
    int n, k;
    cin>>n>>k;
    for(int i = 1; i <= 10; i++)cin>>e[i];
    for(int i = 1; i <= n; i++){ cin>>hum[i].w; hum[i].id=i;}
    sort(hum+1,hum+1+n,cmp);
    for(int i = 1; i <= n; i++){
        int c = (i-1)%10+1;
        hum[i].w += e[c];
    }
    sort(hum+1,hum+1+n,cmp);
    for(int i = 1; i <= k; i++)
        cout<<hum[i].id<<" ";
    return 0;
}
原文地址:https://www.cnblogs.com/gwj1314/p/9444733.html