Submit | All submissions | Best solutions | Back to list |
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.
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 |
hide comments
|
|||||
2021-11-23 00:29:02 vas14
He starts at work and must end up at work. |
|||||
2015-01-11 16:02:55 Shubham
Make sure to put ans in Case #i format :) caused me 2 WA...;( |
|||||
2014-05-22 13:52:57 `Ak
nice prob .... silly mistake costed 6 wa :( :( finally got ac :) :) Last edit: 2014-05-22 14:15:03 |
|||||
2014-05-10 14:11:46 Trishla Sancheti
why is it getting TLE ..?? using normal logic |
|||||
2013-06-27 17:23:14 BLANKRK
nice prob.... AC in frst attmpt :) |
|||||
2013-04-22 17:33:43 :-)
good problem |
|||||
2013-04-12 15:05:21 raunakrocks
AC!! |
|||||
2013-03-13 23:39:25 The Mundane Programmer
Easy One |