Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Did We Join Priyom Da's Marriage?

By Farhan_meb · Limits 1s, 512 MB

You all heard that our very beloved senior Priyom da got married recently!! Its all in past and now you juniors don’t know if we all from ACM family joined his marriage ceremony or not that was held in Dhaka. We all heard about the ceremony a day before the date, and we were in hurry to go there. So, i am letting u know if we made it!! Or not :(

In this problem, you will be giving all the velocities of the bus we used and the average velocity that we needed to make it in time. You will also be given some queries. In the queries there will be $L$ and $R$ (range), you need to find the average velocity of the given range and decide if we made it in time for the query. If the average velocity of the range is greater or equal of the required average velocity, you can assume we made it in time :D, otherwise not :(

Input

You will be given $N \hspace{.1cm} (1\leq N\leq 10^5)$ the number of velocities of the bus and an array that contains $N$ velocities of the bus $(0\leq array[i]\leq 10^5)$ and average speed we need $V \hspace{.1cm} (1\leq V\leq summation \hspace{.1cm} of \hspace{.1cm} all \hspace{.1cm} array[i])$ and then a query $Q \hspace{.1cm} (1\leq Q\leq 10^5)$. In each query, you will be given a range $L$ and $R$ where $(1\leq L\leq R\leq N)$.

Output

For each query, print “Hurray! we made it in time!!” if the average velocity $\geq$ given average velocity we needed. Otherwise print “Oh! we missed it!!”.

Sample

InputOutput
7
1 9 13 7 19 20 22
12 
3
1 7
1 4
3 5
Hurray! we made it in time!!
Oh! we missed it!!
Hurray! we made it in time!!

Notes

Average velocity is always integer in this problem. Suppose, If average of the range is $3.5666$ then we will take it as $3$.

    Discussion

    Statistics


    80% Solution Ratio

    Nowshin_SEarliest, 2w ago

    TurinhstuFastest, 0.0s

    Jame.boyLightest, 3.0 MB

    abid1729Shortest, 387B

    Submit

    Login to submit