In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
A known Polish proverb is: `The apple always falls near the apple tree'1. Your task is to check this proverb experimentally. For simplicity let us assume that both apple trees and apples stand in one line, so their positions can be described by a single coordinate. Let us also assume that every apple has fallen from the apple tree closest to it.
Write a program that:
The first line of input contains two integers and (), separated with a single space and denoting the number of apple trees and the number of apples. The second line of input contains integers from the range , separated with single spaces and denoting the coordinates of apple trees. The third line of input contains integers from the range , separated with single spaces and denoting the coordinates of apples. We treat both apple trees and apples as points on a line; there can be multiple apple trees and multiple apples in one point.
The first and only line of output should contain the smallest distance between an apple and its apple tree.
For the input data:
3 5 10 1 4 2 2 5 7 8
the correct result is:
Task author: Jakub Radoszewski.