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

11092번 - Safe Passage 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB163988358.865%

문제

A group of friends snuck away from their school campus, but now they must return from the main campus gate to their dorm while remaining undetected by the many teachers who patrol the campus. Fortunately, they have an invisibility cloak, but it is only large enough to cover two people at a time. They will take turns as individuals or pairs traveling across campus under the cloak (and by necessity, returning the cloak to the gate if others remain). Each student has a maximum pace at which he or she is able to travel, yet if a pair of students are walking under the cloak together, they will have to travel at the pace of the slower of the two. Their goal is to have everyone back at the dorm as quickly as possible.

As an example, assume that there are four people in the group, with person A able to make the trip in 1 minute, person B able to travel in 2 minutes, person C able to travel in 7 minutes, and person D able to travel in 10 minutes. It is possible to get everyone to the dorm in 17 minutes with the following plan:

  • A and B go from the gate to the dorm together (taking 2 minutes)
  • A returns with the cloak to the gate (taking 1 minute)
  • C and D go from the gate to the dorm together (taking 10 minutes)
  • B returns with the cloak to the gate (taking 2 minutes)
  • A and B go from the gate to the dorm together (taking 2 minutes)

입력

The input is a single line beginning with an integer, 2 ≤ N ≤ 15. Following that are N positive integers that respectively represent the minimum time in which each person is able to cross the campus if alone; these times are measured in minutes, with each being at most 5 000. (It is a very large campus!)

출력

Output the minimum possible time it takes to get the entire group from the gate to the dorm.

제한

예제 입력 1

2 15 5

예제 출력 1

15

예제 입력 2

4 1 2 7 10

예제 출력 2

17

예제 입력 3

5 12 1 3 8 6

예제 출력 3

29

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ACM-ICPC North America Qualifier 2015 G번

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

출처

대학교 대회

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

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