# SRM 400 DIV2 [250]

#include<iostream>
#include
<vector>
#include
<cmath>
using namespace std;

class GrabbingTaxi{
public:

int minTime(vector <int> tXs, vector <int> tYs, int gX, int gY, int walkTime, int taxiTime)

{

int ans=(abs(gX)+abs(gY))*walkTime;

for (int i=0;i!=tXs.size();++i)

if (walkTime*(abs(tXs[i])+abs(tYs[i]))+taxiTime*(abs(gX-tXs[i])+abs(gY-tYs[i]))<ans)
ans
=walkTime*(abs(tXs[i])+abs(tYs[i]))+taxiTime*(abs(gX-tXs[i])+abs(gY-tYs[i]));

return ans;
}

}
;

### Problem Statement

You are walking in the city on a holiday. Suddenly, you are told to go to your office as soon as possible by your boss via cell phone. The city is infinite in size, with vertical streets located at every integer X value and horizontal streets located at every Y value. You are currently located at (0, 0) and your office is located at (gX, gY). There are some taxi stands in the city and their locations are (tXs[i], tYs[i]). You can either go to the office by foot or go to some taxi stand, get a taxi there and go to the office by taxi. It takes walkTime seconds to go along the street to proceed to a horizontally or vertically adjacent intersection by foot and it takes taxiTime seconds by a taxi.

Return the least amount of time that it will take you to go to your office.

### Definition

 Class: GrabbingTaxi Method: minTime Parameters: vector , vector , int, int, int, int Returns: int Method signature: int minTime(vector tXs, vector tYs, int gX, int gY, int walkTime, int taxiTime) (be sure your method is public)

### Constraints

- tXs will contain between 0 and 50 elements, inclusive.
- tXs and tYs will contain the same number of elements.
- Each element of tXs and tYs will be between -10000 and 10000, inclusive.
- gX and gY will be between -10000 and 10000, inclusive.
- walkTime and taxiTime will be between 1 and 1000, inclusive.

### Examples

0)

 {} {} 3 2 10 2
Returns: 50
 There are no taxi stands. You have to walk to the goal.
1)

 {-2, -2} {0, -2} -4 -2 15 3
Returns: 42
 First, you walk to (-2, 0) and get a taxi. Then you go to the goal by it.
2)

 {3} {0} 5 0 10 20
Returns: 50
 taxiTime may be larger than walkTime.
3)

 {34, -12, 1, 0, 21, -43, -98, 11, 86, -31} {11, 5, -68, 69, -78, -49, -36, -2, 1, 70} -97 -39 47 13
Returns: 2476
4)

 {82, -60, 57, 98, 30, -67, 84, -42, -100, 62} {-7, 90, 53, -56, -15, -87, 22, -3, -61, -30} 21 15 53 2
Returns: 1908

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.

#### SRM602 (div2)

2013-12-29 15:13:48

#### 记第一次SRM （SRM489 div2）

2010-12-01 09:41:00

#### SRM145_DIV2

2016-10-24 09:08:27

#### SRM 145 DIV 2 250

2016-10-19 00:35:25

#### SRM 399 DIV2 [250]

2008-04-26 15:05:00

#### SRM 387 DIV2 [250]

2008-04-26 16:24:00

#### SRM 597 DIV2 250

2013-11-21 10:34:19

#### SRM 586 DIV2 250

2013-08-02 11:49:33

#### SRM 398 DIV2 [250]

2008-04-26 13:46:00

#### TC SRM 400 DIV2

2012-07-09 13:29:06