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

32662번 - Always Know Where Your Towel Is 스페셜 저지다국어

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

문제

Arthur wants to go swimming. Another chance to use his favourite towel! He is concerned that if he leaves it out at the pool then someone might take it. So he keeps it in a locker.

Accessing the lockers is done in a peculiar way. One has to use an app on their phone to unlock the lockers. The app displays $N$ distinct positive integers whose sum is at most 2ドル^N-2$. The lockers are also numbered from 1ドル$ to 2ドル^N-2$. To open locker $S,ドル one simply pushes a subset of buttons on the app (a "combination") whose sum is exactly $S$. Pushing a button multiple times has the same effect as pushing it once, so there is no point to pushing a button more than once.

Arthur makes some observations. Oddly, it might be impossible to open some lockers. Also, since there are 2ドル^N-1$ nonempty subsets of buttons and each such subset has its values summing to an integer from 1ドル$ to 2ドル^N-2,ドル then there must be at least one locker that can be opened with more than one combination.

Arthur does not want to forget where he puts his towel when he goes swimming. He believes it will be easier to remember which locker he uses if it has more than one combination that can open it. Help Arthur find such a locker!

입력

The first line of input contains a single integer $N$ (3ドル \leq N \leq 42$). Then next and final line contains $N$ positive integers $a_1, \ldots, a_N$. These integers are distinct and satisfy $\sum_{i=1}^N a_i \leq 2^N-2$.

출력

Output a single integer $S$ (1ドル \leq S \leq 2^N-2$) such that locker $S$ can be opened by more than one combination. If there are multiple possible solutions, any will suffice.

제한

예제 입력 1

5
2 5 8 4 7

예제 출력 1

9

예제 입력 2

3
1 2 3

예제 출력 2

3

예제 입력 3

7
19 24 11 23 9 21 18

예제 출력 3

41

힌트

출처

ICPC > Regionals > North America > North Central North America Regional > 2024 North Central NA Regional Contest A번

ICPC > Regionals > North America > Rocky Mountain Regional > 2024 Rocky Mountain Regional Contest B번

ICPC > Regionals > North America > Mid-Central Regional > 2024 Mid-Central USA Programming Contest B번

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

출처

대학교 대회

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

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