Mobilization in Russia
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
There are \(n\) mobilized soldiers on the territory of Russia. Soldier \(i\) is located at the point \((x_i, y_i)\). In order to save the Armed Forces of Ukraine shells, Russia decided to gather all soldiers at a single point. Russian soldiers can only move in 2 ways: from point \((x, y)\) to \((x+2, y+1)\) or \((x+1, y+2)\). What is the minimum total number of steps the soldiers have to make to gather at a single point, if possible?
Input
The first line contains a single integer — \(n\).
The next line contains \(n\) integers \(x_i\) — the \(x\) coordinates of the mobiks.
The next line contains \(n\) integers \(y_i\) — the \(y\) coordinates of the mobiks.
Output
Output a single integer — the minimum number of steps required for
the Russian soldiers to gather at a single point. If it is impossible to
gather at a single point, output Civil war..
Constraints
\(1 \le n \le 10^5\),
\(0 \le x_i \le 10^9\),
\(0 \le y_i \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 0 1 1 0 | 2 |
| Input (stdin) | Output (stdout) |
|---|---|
| 2 0 1 0 1 | Civil war. |
| Input (stdin) | Output (stdout) |
|---|---|
| 3 0 2 4 0 1 2 | 3 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|