agent3889's blog

By agent3889, 6 years ago, In English,

This is about the CF round 260 Problem A (Laptops)

I saw this code as an accepted solution. How could this approach solve this problem.? It seems extremely simple. Not even used a sort function.

 
 
 
 
  • Vote: I like it
  • -5
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

As you can see all ai(prices) and all bi(quality) lie between 1 to n and are all distinct. That is the key , now SUPPOSE we sort the laptops on basis of price then a laptop can be better only when it has a quality > price coz all are distinct. Think about it it is a simple logic :)