Create 1092_972964894.cpp

From https://vijos.org/p/1282/solution
This commit is contained in:
KiritoTRw 2016-05-02 13:44:55 +08:00
parent 3a90be3bcc
commit a94676f490

32
QUSTOJ/1092_972964894.cpp Normal file
View File

@ -0,0 +1,32 @@
#include<iostream>
#include<algorithm>
using namespace std;
struct leaf{
long long x,y,z;
}a[50000];
long long n,k,w[10],i;
bool cmp(leaf a,leaf b){
return (a.x>b.x) || (a.x==b.x && a.z<b.z);
}
int main(){
cin>>n>>k;
for (i=0;i<10;i++) cin>>w[i];
for (i=0;i<n;i++){
cin>>a[i].x;
a[i].z=i+1;
}
sort(a,a+n,cmp);
for (i=0;i<n;i++){
a[i].y=i;
a[i].x+=w[a[i].y%10];
}
sort(a,a+n,cmp);
for (i=0;i<k;i++){
cout<<a[i].z;
if (i+1==k) cout<<endl;
else cout<<' ';
}
return 0;
}