Explanation
Since , we can iterate through every pair of points.
To avoid processing the same set of points multiple times, we'll only search for the pairs that don't have an collinear point of equal distance to the left. Once this check succeeds, we'll see how many equally-spaced points to the right there are.
Implementation
Time Complexity:
C++
#include <algorithm>#include <iostream>#include <map>#include <vector>using namespace std;Code Snippet: Point Struct (Click to expand)int main() {
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!