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

Busy Bees

Busy Bees

There is an infinite beehive consisting of hexagonal cells. Some cells contain workers which deliver honey to the queen. Each cell can contain any number of bees at any moment of time. Workers can move between cells that have a common edge, and the queen can not move. The distance between two cells is the minimum number of moves required for a worker to travel between them. Workers are very busy and they want to spend minimal possible time to travel to the queen. You are given coordinates of \textbf{N} distinct cells which contain workers; the coordinate system is illustrated below. Find the cell where the queen should be placed so that the sum of distances between her cell and all the cells which contain workers is minimal possible. \includegraphics{https://static.e-olymp.com/content/bd/bdc1e9fccca8809415dd88cda5fee7ef5ba86b2e.jpg} \InputFile The first line of input contains an integer \textbf{N}, the number of workers (\textbf{1} ≤ \textbf{N} ≤ \textbf{10^5}). Next \textbf{N} lines contain two integers each: coordinates of workers cells. Each of the coordinates does not exceed \textbf{10^9} by absolute value. It is guaranteed that all cells are distinct. \OutputFile Output the coordinates of the required cell. If there are multiple solutions, output any of them.
Zaman məhdudiyyəti 2 saniyə
Yaddaşı istafadə məhdudiyyəti 256 MiB
Giriş verilənləri #1
3
3 0
4 4
0 2
Çıxış verilənləri #1
3 0