408770: GYM103306 E E-13 Storage Unit
Description
Planet E-13 orbits around a star in a faraway galaxy named UAZ. In that planet, people live for centuries and some inhabitants, such as Thanitos, like to record videos from their daily life (and oh dear, he has really made a few). Up until now, Thanitos has been using an old technology where videos are recorded in tapes that take up too much physical space, and he wants to paste some of the $$$N$$$ videos he has made, into a new kind of storage unit that is really small but has much more capacity (a single storage unit could hold up the content of several video tapes). He has his $$$N$$$ video tapes in chronological order, and for each of them he has calculated how much space would be required in MB to put them into a storage unit. A requirement is that the videos selected to be placed in a storage unit must be consecutive. That is, if for instance, Thanitos has the following 7 videos, and the storage unit has a 2048 MB capacity:
Video number | Size |
1 | 512 |
2 | 17 |
3 | 802 |
4 | 10 |
5 | 1024 |
6 | 905 |
7 | 130 |
Then if the first video Thanitos puts in the storage unit is video number 1, he must put in the same storage unit, videos number 2, 3 and 4, since they are consecutive and still fit in the storage unit. If the first video Thanitos puts in the storage unit is Video 2, then he must also put videos 3 and 4, or if the first video Thanitos puts is video 5 then he must put video 6 (video 7 could not be put since it would exceed the capacity of the storage unit).
Thanitos wants to know 2 things, given the size of each of the $$$N$$$ videos (in MB) and the capacity of a storage unit (possible given in MB, GB or TB):
- What is maximum number of videos $$$R$$$, such that, regardless of which video is selected as the initial one to be stored (from the ones numbered $$$1$$$ to $$$N-R+1$$$), the storage unit will hold at least that number $$$R$$$ of videos.
- What is the least video number $$$L$$$, such that if it is the first video that is put in the storage unit and we try to put $$$R+1$$$ consecutive videos in it, the storage unit capacity would be exceeded (A value of $$$-1$$$ indicates that no matter what video is selected as initial one, the capacity is not exceeded)
The first line contains an integer number $$$N$$$ and a string $$$C$$$ separated by a space ($$$1 \leq N \leq 10^6$$$, $$$100MB \leq C \leq 10240TB$$$) , $$$N$$$ is the number of videos that Thanitos has made, and $$$C$$$ is a string representing the capacity of a single storage unit. $$$C$$$ is suffixed with an $$$M$$$, a $$$G$$$ or a $$$T$$$ indicating the capacity is in Megabytes (MB), Gigabytes (GB) or Terabytes (TB). The second line contains $$$N$$$ integers separated by a space, where the $$$i$$$-th integer represents the size in Megabytes $$$s_i$$$ the video with number $$$i$$$ would require to be stored in the storage unit. For all $$$i$$$, $$$10 \leq s_i \leq min(10240,C)$$$.
OutputPrint a line containing two integers separated by a space: $$$R$$$ and $$$L$$$, according to the description given above.
ExampleInput9 2G 512 17 802 10 1024 905 130 1838 15Output
2 5