Logo
(追記) (追記ここまで)

3535번 - Gadgets Factory 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB225436.364%

문제

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.

제한

예제 입력 1

3 5
-1 3
0 1
2 3
4 2
5 2

예제 출력 1

1
2.0

예제 입력 2

2 5
1 1
2 2
3 1
4 2
5 1

예제 출력 2

4
1.5
2.5
3.5
4.5

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > NEERC Northern Subregional 2010 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /