Nộp bài  Các bài nộp  Làm tốt nhất  Về danh sách bài 
MJOURNEY  Journey with Pigs 
English  Vietnamese 
Farmer John has a pig farm near town A. He wants to visit his friend living in town B. During this journey he will visit n small villages so he decided to earn some money. He tooks n pigs and plans to sell one pig in each village he visits. Pork prices in villages are different, in the jth village the people would buy a pork at pj rubles per kilogram. The distance from town A to the jth village along the road to town B is dj kilometers. Pigs have different weights. Transporting one kilogram of pork per one kilometer of the road needs t rubles for addition fuel.
Help John decide, which pig to sell in each town in order to earn as much money as possible.
Input
The first line of the input file contains integer numbers n (1 ≤ n ≤ 1000) and t (1 ≤ t ≤ 10^9). The second line contains n integer numbers wi (1 ≤ wi ≤ 10^9) — the weights of the pigs. The third line contains n integer numbers dj (1 ≤ dj ≤ 10^9) — the distances to the villages from the town A. The fourth line contains n integer numbers pj (1 ≤ pj ≤ 10^9) — the prices of pork in the villages.
Output
Output n numbers, the jth number is the number of pig to sell in the jth village. The pigs are numbered from 1 in the order they are listed in the input file.
Sample
Input: 3 1 10 20 15 10 20 30 50 70 60 Output: 3 2 1
Được gửi lên bởi:  psetter 
Ngày:  20090226 
Thời gian chạy:  1s 
Giới hạn mã nguồn:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Ngôn ngữ cho phép:  Tất cả ngoại trừ: C99 ERL GOSU JSRHINO PERL6 PYPY RUST SED 
Nguồn bài:  NEERC 2007–2008 
hide comments
20130908 11:14:26 a;slkfjasl;fkj
lợn này là lợn đập chắc trong don't starve đây :v 

20121211 14:20:19 Phạm Vãn Ðức
tham lam mà,chấp n^2 cũng vẫn dưới 1s mà sao mình chạy toàn quá time thế ? 

20101126 13:35:19 Lê Ðỗ Tân
Sao bài này cho n nhỏ thế nhỉ, n khoảng 10^5 vẫn làm đc trong 1s mà :?? 

20091123 14:57:36 Quit ™ ►Exit™
bất đẳng thức hoán vị!!!!1 

20090402 20:23:07 dhkhtn
C1 : cap ghep? C2 : sach toan cap 3 ??? Last edit: 20090402 20:25:58 