Request for Help with CP Problem

Правка en1, от BinaryCrazy, 2020-04-02 01:49:16

Hi all,

Hope you are having a great day. I found this question on HackerEarth, and received a "Partially Accepted" verdict, but have no idea why.

Can someone please explain where my logic is wrong? I have listed my logic below.


Logic

Sort all the values for which one needs to perform the HIT operations.

Next, for each value, binary search to find the last index that satisfies the following inequality:

a[i] — i >= x[i] (1 indexing)

We subtract that from the original value, and output the resulting array.

Implementation.


Thanks a lot for your time and help.

It is greatly appreciated.

Regards,

BC

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский BinaryCrazy 2020-04-02 01:49:16 941 Initial revision (published)