Editorial for RGPC '17 P1 - Circle Clicking!


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: chenj

This problem simply asks you to repeatedly calculate the distance between two consecutive points using the Pythagorean theorem or the distance formula \sqrt{(y_2 - y_1)^2 + (x_2 - x_1)^2}. If the distance is less than or equal to D, increment a counter for the current combo; otherwise, update a counter for maximum combo if the current combo is greater, and then reset the current combo to 0. Make sure to update the coordinates of x_1 and y_1 to x_2 and y_2 so you're not just calculating distances from point 1 to all other points.

Time complexity: \mathcal{O}(N)


Comments

There are no comments at the moment.