antennas[i] = [x, y, q] is an antenna at (x, y) with power q. Distance is the usual Euclidean distance.
An antenna is picked up at a point if its distance d from that point is at most reach. It then contributes a signal of ⌊q / (1 + d)⌋ there (division rounded down). Antennas farther than reach contribute nothing. The connection strength at a point is the sum of the signals of all antennas picked up there.
Find the point with non-negative integer coordinates where the connection strength is the highest and return it as [x, y]. If several points tie, return the smallest one: the smaller x, and for equal x the smaller y.antennas=[[2, 3, 12], [4, 3, 8]], reach=2 → [2, 3]
At (2, 3) the first antenna gives ⌊12 / 1⌋ = 12 and the second, 2 away, gives ⌊8 / 3⌋ = 2, for 14 in total. At (3, 3) it would be only 6 + 4 = 10.
antennas=[[0, 4, 6], [4, 0, 6]], reach=1 → [0, 4]
Both (0, 4) and (4, 0) get a signal of 6; we pick the smaller point, (0, 4).
antennas=[[7, 9, 0]], reach=5 → [0, 0]
The antenna is switched off, the signal is 0 everywhere, so the answer is (0, 0).
antennas=[[2, 3, 12], [4, 3, 8]], reach=2
[2, 3]
Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.