my solution is getting RE.
my solution for N=1, https://ideone.com/gSmvtm
my technique is,
- i seek distance of king from (-1000000,-1000000) its d1
- i seek distance of king from (1000000,1000000) its d2
- so now king is either on (x1,y1)= (-1000000+d1, 1000000-d2) or on (x2,y2)= (1000000-d2, -1000000+d1)
sol for testing, https://ideone.com/khL4Ps
here suppose king position is (500,1000), its showing correct solution in my pc.