【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;
}
posted @ 2018-06-02 21:04  gwj1139177410  阅读(172)  评论(0编辑  收藏  举报
选择