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

Prinova

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
Gold III 골드 III
난이도
1s
시간 제한
32MB
메모리 제한
1
맞았습니다!!
1
제출 수
100.0%
정답률
레이팅

의견: 0

설명

Brojko and Brojana are happily married with \(N\) little boys. The boys are named with distinct even integers \(P_1, P_2, \ldots, P_N\).

Brojko and Brojana are expecting an addition to their family and have to come up with a nice name for the little girl. They have decided that the name will be an odd integer in the range \([A, B]\). Because they find all integers in that range equally beautiful, they have decided to choose the number which maximizes the distance to the name of the closest of the \(N\) boys.

More precisely, they seek an odd integer \(X \in [A, B]\) such that the expression

$$ \min\{\,|X - P_i| : i \in [1, N]\,\} $$

is as large as possible.

Write a program that determines the name for the little girl. If there are multiple solutions, output any of them.

제약
입력 형식

The first line contains an integer \(N\) (\(1 \le N \le 100\)), the number of boys.

The second line contains \(N\) distinct even integers, the names of the boys. The integers will be less than \(10^9\).

The third line contains the integers \(A\) and \(B\) (\(1 \le A < B \le 10^9\)), the range of names they are considering for the girl.

출력 형식

Output an integer, the name for the little girl.

서브태스크
서브태스크점수설명

Subtask 1

30점
예제 1
입력
3
2 6 16
20 50
출력
49
예제 2
입력
3
2 6 16
3 15
출력
11
예제 3
입력
3
2 6 16
1 7
출력
5
문제 정보

riseoj 작성

출처 COCI 2007/2008 Contest 1

평가 및 의견

Prinova

개요
출제자 난이도 Gold III 골드 III 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Prinova

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