|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|3 초||256 MB||8||2||1||25.000%|
Mr. Smith is a very rich gadgets fan. As soon as he realized that he cannot buy all the gadgets he wants just because they are not yet produced, he decided to build his own Gadgets Factory.
The Gadgets Factory will be built at a place called ‘Silicon Road”. This road concentrates production of highly technological parts required to produce gadgets. The Silicon Road is straight and the factories are placed very close to it, so the road can be considered as an axis, and factories can be considered as points on it.
There are n parts needed to produce gadgets, and m factories that produce these parts. Mr. Smith wants to minimize the sum of squared distances to the nearest factories that produce each of required parts. Help him to find all the points in which that sum is minimal.
The first line of the input file contains integer numbers n and m (1 ≤ n ≤ 10 000; n ≤ m ≤ 100 000).
Next m lines contain pairs of integer numbers xi and pi, xi is the coordinate of i-th factory, and pi is the identifier of the part that it produces (|xi| ≤ 100 000; xi ≤ xi+1; 1 ≤ pi ≤ n).
For each required part there is at least one factory that produces it.
The first line of the output file should contain an integer number k — the number of points where the Gadgets Factory can be built.
Next k lines should contain these points in ascending order. The values should be accurate within an absolute error of 10−6.
3 5 -1 3 0 1 2 3 4 2 5 2
2 5 1 1 2 2 3 1 4 2 5 1
4 1.5 2.5 3.5 4.5