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

24755번 - Election Paradox 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB17914212582.781%

문제

In Oddland, the leader of the country is determined by a democratic election. The country is divided into an odd number of regions, in which each region has an odd number of voters.

There are two (an even number!) political parties in Oddland, and the winning party is the one that wins the most number of regions. A party wins a region if it receives more votes than the other party in that region.

Under this system, it is possible that the losing party receives more votes than the winning party. For example, if there are three regions with 11ドル,ドル 3ドル,ドル and 3ドル$ people, respectively, then a party could receive 8ドル,ドル 1ドル,ドル and 1ドル$ votes and lose the election. In this case, the losing party received the majority of the votes in the total population.

Determine the largest number of votes a party can receive and still lose the election.

입력

The first line of input contains an odd integer $N$ (3ドル \leq N \leq 999$), which is the number of regions in Oddland.

The next line contains $N$ odd integers $p_i$ (1ドル \leq p_i \leq 999$), which are the populations of the $N$ cities.

출력

Display the largest number of votes a party can receive and still lose the election.

제한

예제 입력 1

3
11 3 3

예제 출력 1

13

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2021 Rocky Mountain Regional Contest E번

  • 문제를 만든 사람: Howard Cheng
(追記) (追記ここまで)

출처

대학교 대회

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

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