@EvgenyKluev, , , , .
x
, , x
, , x
, ( integer x
, ).
(-, , ) : A - , , S - . S-A . S-A ( ), .
, - -
binary search for x on [0,N]:
find R(S), the enclosing rectangle of S
for each corner C of R(S):
align one square at C, let the points covered by that square be A
find R(S-A)
do two squares aligned at opposite corners of R(S-A) cover S-A?
, , , , x
- , , . O (n log n) .