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 LL and RR (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 :(


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


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!!".


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


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



    81% Solution Ratio

    Nowshin_SEarliest, Oct '20

    TurinhstuFastest, 0.0s

    Jame.boyLightest, 3.0 MB

    abid1729Shortest, 387B


    Login to submit


    The main goal of this problem is to calculate average velocities for QQQ queries. If you write a bru...

    Toph uses cookies. By continuing you agree to our Cookie Policy.