How to solve this problem ?

Revision en1, by code_hard123, 2017-03-18 12:25:03

Given N points in two dimensional space and Q queries. In each query, given two non negative integers a , b. Find the point (x,y) such that F(x,y) is minimum, where F(x,y) = a * x + b * y

Constraints:
1 <= N <= 10^6
1 <= Q <= 10^5
0 <= a , b <= 10^9
0 <= |x| , |y| <= 10^9

Thank You!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English code_hard123 2017-03-18 12:25:03 347 Initial revision (published)