Looks standard problem but how to approach? Please help.

Revision en3, by abhist2, 2020-11-23 16:14:21

Hi everyone,

I need help in a question. It came to one of the contest I gave around 4 days ago. It was a hiring contest of a good indian company.

My approach was to store ai and bi as pairs in vector and sort them. So for each query we can get the count of chocolates having sweetness greater than x using binary search on vector but now how to get the count of lifetime greater than y? I got stuck here. I still couldn't think of something. Can you tell me how to approach?

It'll be really great if anyone can help me or give me some insight.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English abhist2 2020-11-23 16:14:21 149
en2 English abhist2 2020-11-23 16:13:00 14
en1 English abhist2 2020-11-23 16:11:18 599 Initial revision (published)