WORKB - Working in Beijing
Mr. M is an undergraduate student of FDU, Shanghai. He finds an intern position in Beijing, so that he cannot attend all the college activities. But in some conditions, he must come back to Shanghai on certain dates. We can assume the important activities that Mr. M must attend occupy a whole day. Mr. M must take a flight to Shanghai before that day and leave after that day. On the other hand, when Mr. M is absent in Beijing and he will lose his salary for his absence.
Sometimes the cost of a flight is much higher than the loss of salary, so to save the cost on the travel, Mr. M can stay in Shanghai to wait for another important date before he returns to Beijing.
Now, Mr. M knows all of the important dates in the next year. Help him schedule his travel to optimize the cost.
Input
The input contains several test cases. The first line of single integer indicates the number of test cases.
For each test case, the first line contains three integers: n, a and b, denoting the number of important events, the cost of a single flight from Beijing to Shanghai or Shanghai to Beijing and the salary for a single day stay in Beijing. (1 ≤ n ≤ 100000, 1 ≤ a ≤ 1000000000, 1 ≤ b ≤100)
Next line contains n integers ti, denoting the dates of the important events. You can assume the ti are in increasing order and they are different from each other. (0 ≤ ti ≤ 10000000)
Output
For each test case, output a single integer indicating the minimum cost for this year.
Example
Input: 2 1 10 10 5 5 10 2 5 10 15 65 70 Output: Case #1: 30 Case #2: 74
Warning: large input/output data, be careful with certain languages.
hide comments
vas14:
2021-11-23 00:29:02
He starts at work and must end up at work. |
|
Shubham:
2015-01-11 16:02:55
Make sure to put ans in Case #i format :)
|
|
`Ak:
2014-05-22 13:52:57
nice prob ....
|
|
Trishla Sancheti:
2014-05-10 14:11:46
why is it getting TLE ..?? using normal logic
|
|
BLANKRK:
2013-06-27 17:23:14
nice prob....
|
|
:-):
2013-04-22 17:33:43
good problem |
|
raunakrocks:
2013-04-12 15:05:21
AC!! |
|
The Mundane Programmer:
2013-03-13 23:39:25
Easy One
|
Added by: | Fudan University Problem Setters |
Date: | 2011-09-08 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Fudan University Local Contest #3, by lcosvse |