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

30310번 - Finding Forks 다국어

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

문제

Your cutlery drawer contains many types of forks. Each with their own purpose, and each with its own place in the cutlery drawer. After a nice dining party with all your friends, disaster struck! You put all the used forks in the dishwasher, but now you are unsure where to put back some of the forks, because at least two places in the cutlery drawer are empty! And worse, you do not remember which type of fork belongs where!

What is the minimum number of forks that must have been in the dishwasher to cause this confusion?

입력

The input consists of:

  • One line with an integer $n$ (2ドル\leq n\leq 10^5$), the number of types of forks.
  • One line with $n$ integers $a$ (1ドル\leq a \leq 10^9$), the number of forks of each type.

출력

Output the minimum number of forks that must have been in the dishwasher.

제한

예제 입력 1

3
4 9 5

예제 출력 1

9

예제 입력 2

10
18 39 5 12 1000000000 54 23 11 123 31415

예제 출력 2

16

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2023 Preliminaries F번

  • 문제를 만든 사람: Ragnar Groot Koerkamp
(追記) (追記ここまで)

출처

대학교 대회

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

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