mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1092.cpp
This commit is contained in:
parent
2815bda582
commit
ec1c635c26
43
QUSTOJ/1092.cpp
Normal file
43
QUSTOJ/1092.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
#define MAXN 50005
|
||||
struct pack
|
||||
{
|
||||
long a,b,c;
|
||||
};
|
||||
pack PK[MAXN];
|
||||
int W[16];
|
||||
bool cmp(pack a,pack b){
|
||||
return (a.a>b.a) || (a.a==b.a && a.c<b.c);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int n,k;
|
||||
scanf("%d %d",&n,&k);
|
||||
for(int i=0;i<10;i++)
|
||||
{
|
||||
scanf("%d",&W[i]);
|
||||
}
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%ld",&PK[i].a);
|
||||
PK[i].c=i+1;
|
||||
}
|
||||
sort(PK,PK+n,cmp);
|
||||
for (int i=0;i<n;i++){
|
||||
PK[i].b=i;
|
||||
PK[i].a+=W[PK[i].b%10];
|
||||
}
|
||||
sort(PK,PK+n,cmp);
|
||||
for (int i=0;i<k;i++){
|
||||
printf("%ld",PK[i].c);
|
||||
if (i+1==k) printf("\n");
|
||||
else printf(" ");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user