Alden's Lazer Gun

Submit solution

Points: 0
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
C, C++, Java, Python

Alden is stuck in the middle of an old-fashioned zombie apocalypse. More specifically, Alden is stuck in the middle of Cameron Hall (or what is left of it since it is now an infinite plane). Each zombie is described with two coordinates \((x,y)\) on this plane.

Fortunately (for Alden), he has a latest duel-direction lazer gun. He stands at the point \((x_0, y_0)\) and in one shot it can destroy anything situated on some line crossing this point \((x_0, y_0)\).

Your task is to determine what minimum number of shots Alden needs to make to save himself.

This gun is very fast and zombies (as we all know) are very slow and so they do not move between shots.

Input Specification

The first line contains three integers \(n, x_0, y_0 (1 \leq n \leq 1000, -10^4 \leq x_0, y_0 \leq 10^4)\), the number of zombies and Alden's location.

The next \(n\) lines contain two integers \(x_i, y_i (-10^4 \leq x_i, y_i \leq 10^4)\), the coordinates of each zombie. No two zombies will stand in the same place as Alden. Multiple zombies can stand at the same place however.

Output Specification

A single integer, the number of shots Alden needs to make to destroy all the zombies.

Sample Input 1

4 0 0
1 1
2 2
2 0
-1 -1

Sample Output 1


Sample Input 2

2 1 2
1 1
1 0

Sample Output 2



There are no comments at the moment.