RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 R03752

Glasnici

설명

A long straight road connects two villages. Along the road, N messengers are stationed and, when
needed, they exchange messages using mostly their legs, but also their vocal cords and ears.
The first messenger (the closest to the first village) has a rad\(io-re\)ceiver which he uses to keep track of
current ongoings in the country. When he finds out who has been evicted from whichever reality show
is currently popular, he starts running as fast as he can to share the unfortunate (or fortunate) news
with everyone else. While running, he shouts the name of the evicted person so that any fellow
messengers that are close enough can hear him. Meanwhile, the remaining messengers do not merely sit
and wait, but also run themselves, all with the selfless goal of sharing the news with everyone as fast as
possible.
The running and shouting proceeds as follows:
• Each of the messengers may run whenever, in either direction, at a speed of at most 1 unit
per second, or may decide not to run at all and stand still.
• All messengers that know the news shout it at all times. One messenger can hear another
messenger shouting (and learn the news) if the distance between them is at most K units.
Write a program that, given the initial locations of the messengers, determines the least amount of
time (in seconds) needed for all messengers to learn the news. The location of every messenger is
given with a positive real number – the distance from the first village. As mentioned above, initially
only the first messenger knows the news.

제약
입력 형식

The first line contains the real number K (\(0 \le K \le 10^{6}\)), the largest distance at which two messengers
can hear each other.
The second line contains the integer N (\(1 \le N \le 100\,000\)), the number of messengers.
Each of the following N lines contains one real number D (\(0 \le D \le 10^{9}\)), the distance of one messenger
from the first village. The distances will be sorted in ascending order. It is possible for multiple
messengers to be at the same location.

출력 형식

Output a real number, the least time for all messengers to learn the news. Your output will be accepted
if it differs from the official output by no more than ±0.001.

예제 1
입력
3.000
2
0.000
6.000
출력
1.500
예제 2
입력
2.000
4
0.000
4.000
4.000
8.000
출력
1.000
문제 정보

생성자가 기록되지 않았습니다.

출처 COI 2008

평가 및 의견

Glasnici

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Glasnici

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8