Submit | All submissions | Best solutions | Back to list |
ALIEN2 - Aliens at the train, again! |
The Alien who doesn’t like to see humans has moved to an Urban City (Yes, a little ironic) and now she’s facing a double-train system, but still, the alien hates humans, so she wants to see the minimum quantity of people possible in her way to the university at the two trains.
The Alien has some sort of anthropophobia, this means she has a phobia to the people or the society, knowing this, she tells you that can only see K persons in the train, if she sees more than that, she will have a panic attack.
With her special powers, the alien knows how much people is on every station of the train A and the train B, she asked you to make a program that, given the number of people in the stations of the train A and B and the maximum number of people she wants to see, you give her the number of stations she will have to cross and the minimum persons found in those stations. Knowing that:
- The Alien starts from train A or B (she can choose where to start) but from the station 1.
- She can switch from train A or B or viceversa, if she does this, she will see Ai+Bi people, being “i” the station she’s at that moment.
- If she sees strictly more persons than the specified, she will automatically exit the train.
INPUT:
The input will contain two integers N (1<=N<=10,000) and K (1<=65,000) being the number of stations and the maximum number of people that the alien wants to see, then, 2 lines will follow, each containing N integers separated by a single space denoting the number of people found in the j-th station of the i-th train. (1<=Ni<=100)
OUTPUT:
Two single numbers denoting the number of stations passed and the people seen.
SAMPLE DATA:
INPUT:
3 10
9 2 4
1 2 9
OUTPUT:
3 9
INPUT2:
5 10
1 7 1 1 1
2 2 2 2 2
OUTPUT2:
5 9
Explanation I/O 1: The alien starts at the train B station 1, she sees 1 people, she continues to the station 2 and then decides to change the train, the alien have seen 4 more people, and then she continues at the train A up to the station 3. At this point the Alien will see (1+4+4) people (9) and has passed 3 stations.
Added by: | david_8k |
Date: | 2012-01-22 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own Problem |
hide comments
|
|||||||
2020-07-09 19:37:15
if(A[1] > k and B[1] > k) print -> 0 0 |
|||||||
2020-05-02 19:06:20
you have to minimize the number of people and maximize the number of stations |
|||||||
2020-04-25 17:41:19
Use FastIO method when doing in java |
|||||||
2020-04-02 20:51:58
i solved for n max value =1,000 still AC....... pair<> DP[10001][65001] not possible... ;{ |
|||||||
2020-03-30 22:28:39
The problem statement is unclear you have to actually leave the station before the point when monster exceed k 5 13 15 5 10 5 5 11 1 4 5 5 For this Ans is 2 12 |
|||||||
2020-03-30 03:28:53
one shot AC btw good problem check for the tie cases |
|||||||
2019-06-08 22:22:23
AC in one go!!! |
|||||||
2019-05-29 21:56:34
remember she does not like human, even if path length is same |
|||||||
2018-11-09 05:56:50
problem statement is not clear... my sol got AC... we have to maximize number of stations with poeple<=k |
|||||||
2017-06-15 21:10:35
Finally got an iterative solution !! AC in 0.0 |