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

16839번 - Clique Coloring 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB54161252.174%

문제

There is a complete graph with m vertices. Initially, the edges of the graph are not colored. Snuke performed the following operation for each i(1 ≤ i ≤ n): Choose ai vertices from the graph and paint all edges that connect two of the chosen points with color i. It turned out that no edges were painted more than once. Compute the minimal possible value of m.

입력

First line of the input contains one integer n (1 ≤ n ≤ 5). Then n lines follow, i-th of these lines contains one integer ai (2 ≤ ai ≤ 109).

출력

Print the minimal possible value of m.

제한

예제 입력 1

2
3
3

예제 출력 1

5

예제 입력 2

5
2
3
4
5
6

예제 출력 2

12

노트

Number the vertices of the graph: 1, 2, 3, 4, 5. For example, you can color the graph in the following way:

  • Choose three vertices 1, 2, 3 and color edges between them with color 1.
  • Choose three vertices 1, 4, 5 and color edges between them with color 2.

출처

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2014 Day 2 C번

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 2: Makoto Soejima Contest 1, Japanese Grand Prix C번

Contest > Open Cup > 2014/2015 Season > Stage 6: Grand Prix of Japan C번

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

출처

대학교 대회

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

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