codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

514B.md (1838B)


      1 Source: https://codeforces.com/problemset/problem/514/B
      2 
      3 B. Han Solo and Lazer Gun
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 There are *n* Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (*x*, *y*) on this plane.
     22 
     23 Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (*x*0, *y*0). In one shot it can can destroy all the stormtroopers, situated on some line that crosses point (*x*0, *y*0).
     24 
     25 Your task is to determine what minimum number of shots Han Solo needs to defeat all the stormtroopers.
     26 
     27 The gun is the newest invention, it shoots very quickly and even after a very large number of shots the stormtroopers don't have enough time to realize what's happening and change their location.
     28 
     29 Input
     30 
     31 The first line contains three integers *n*, *x*0 и *y*0 (1 ≤ *n* ≤ 1000,  - 104 ≤ *x*0, *y*0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun.
     32 
     33 Next *n* lines contain two integers each *x**i*, *y**i* ( - 104 ≤ *x**i*, *y**i* ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed that no stormtrooper stands at the same point with the gun. Multiple stormtroopers can stand at the same point.
     34 
     35 Output
     36 
     37 Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 4 0 0  
     45 1 1  
     46 2 2  
     47 2 0  
     48 -1 -1
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 2
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 2 1 2  
     61 1 1  
     62 1 0
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 1
     69 ```
     70 
     71 Note
     72 
     73 Explanation to the first and second samples from the statement, respectively:
     74 
     75  ![](https://espresso.codeforces.com/cb4047eed1803cd98d2758a1cb6d26db52348d09.png)