The Ultimate Weapon
All submissions for this problem are available.There are $M$ enemy troops on the ground. The battleground is similar to cartesian coordinate system. Each troop is given a coordinate $(x,y)$ on this system. Joseph has the latest tech to fight these troops - a duplex railgun. It is placed at the point ($x_0$,$y_0$). It takes only a single shot to destroy all the troops situated on some line that passes through ($x_0$,$y_0$). Find the minimum number of shots Joseph requires to defeat all the troops. The railgun is equipped with rapid fire shots, thus it fires really quickly leaving the troops no time to change their location of the battleground. ###Input: - The first line contains 3 integers $M$, $x_0$, $y_0$ — the number of enemy troops on the ground and the coordinates of your railgun. - Next $M$ lines contain two integers each $x_i$, $y_i$ — the coordinates of the troops on the battlefield. It is given that no troops stand at the coordinates of the railgun. Multiple troops may or may not stand at the same point. ###Output: - Print a single integer - the minimum number of shots Joseph needs to destroy all the troops. ###Constraints - $1 \leq M \leq 1000$ - $-10^4 \leq x_0, y_0 \leq 10^4$ - $-10^4 \leq x_i, y_i \leq 10^4$ ###Subtasks - 20 points : $1 \leq M \leq 10$ - 80 points : Original Constraints ###Sample Input 1: 4 0 0 1 1 2 2 2 0 -1 -1 ###Sample Output 1: 2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.