1 /************************************************************************* 2 > File Name: main.c 3 > Author:qusijun 4 > Mail: wiilen.lian@gmail.com 5 > Created Time: 2013年08月08日 星期四 10时19分06秒 6 ************************************************************************/ 7 8 #include<stdio.h> 9 #include<stdlib.h> 10 #define ll long long 11 typedef struct 12 { 13 ll value; 14 int position; 15 16 }Node; 17 18 Node weight[1005],earn[1005]; 19 int cmp(const void *a,const void *b) 20 { 21 Node *aa = (Node*)a; 22 Node *bb = (Node*)b; 23 if (aa->value>bb->value) return 1; 24 else return -1; 25 26 } 27 int main(void) 28 { 29 int i,j,n; 30 ll t; 31 while (scanf("%d%lld",&n,&t)!=EOF) 32 { 33 //int per_wei,per_cost,distance; 34 for (i=1;i<=n;i++) 35 { 36 scanf("%lld",&weight[i].value); 37 weight[i].position = i; 38 } 39 40 ll distance[1005]; 41 for (i=1;i<=n;i++) 42 { 43 scanf("%lld",&distance[i]); 44 } 45 46 for (i=1;i<=n;i++) 47 { 48 ll x; 49 scanf("%lld",&x); 50 earn[i].value = x - t*distance[i]; 51 earn[i].position = i; 52 } 53 //德马西亚! 54 qsort(weight+1,n,sizeof(weight[0]),cmp); 55 qsort(earn+1,n,sizeof(earn[0]),cmp); 56 57 int ans[1005]; 58 for (i=1;i<=n;i++) 59 { 60 printf("%d",earn[i].position); 61 ans[earn[i].position] = weight[i].position; 62 } 63 64 for (i=1;i<=n;i++) 65 { 66 printf("%d ",ans[i]); 67 } 68 printf(" "); 69 70 71 72 73 } 74 return 0; 75 }