eolymp
bolt
Try our new interface for solving problems
Məsələlər

Express delivery

Express delivery

Your company, Byteland Express, has to deliver some papcels to clients located somewhere in the city. The city consist of \textbf{2·10^9+1} south-north streets and \textbf{2·10^9+1} west-east streets (both numbered from \textbf{0} to \textbf{2·10^9}). A postman dreves from one junction to a neighbouring one in one minute. The company is located next to the junction of streets number \textbf{x_c} and \textbf{y_c}. All parcels have to be delivered as fast as possible, so driving to a client located next to the junction of the \textbf{x}-th and \textbf{y}-th street, can take at most (= exactly) \textbf{|x_c-x|+|y_c-y|} minutes. It takes a very short time to give a parcel to a client? so while driving to one client, a postman can give a parcel to another client (but can not choose longer route to do that). Your task is to determine how many postmen are needed to perform the delivery. \textbf{Task} Write a programm, that \begin{itemize} \item reads using SVIO the position of the company and positions of all the clients, \item finds the minimal number of postmen needed to deliver all the parcels, \item writes the result using SVIO. \end{itemize} \InputFile First line of input contains one integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{1000000}). Second line contains location of the compane, the following \textbf{N} lines contain locations oa the clients. A description of the location consists of two integers: coordinates \textbf{x} and \textbf{y} (\textbf{0} ≤ \textbf{x}, \textbf{y} ≤ \textbf{2·10^9}). Every two points (from among company or clients) \textit{differ on both coordinates} (every \textbf{x} is different and every \textbf{y} is different). \OutputFile In the only line of the standart output write one inteher: yhe number of postmen needed to deliver parcels to all clients.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 32 MiB
Giriş verilənləri #1
4
0 3
1 2
2 5
3 0
4 1
Çıxış verilənləri #1
3