papa-ka-para's blog

By papa-ka-para, history, 7 years ago, In English

Hello everyone,

I was trying to solve 451 D question. and which turn out to be an easy question due to given constrain of distinct times for each alarm clocks (Please refer to question if you don't understand).

Now I had doubt. What if there could be repetitive values for alarm clocks timings. is it possible to solve this problem with greedy approach ?

If Yes/no , can you please provide proof method.

Thank you (GL & HF)

Tags 451
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I think yes, we can change your problem into orginal problem, with just one modify, that is integer time will change to real time, and you can imagine one point of time which has many clock turn on like many clock turn on at different time but have very small distance between them.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    fine, getting now. I believe same solution will pass for modified problem also :) .

»
7 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

Here is my solution for the problem 33847285. The idea will work even if the times are not distinct. Because you are always deleting numbers from the back of the active list of points. Which ends up giving us more better chances in the future.