아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Delivery Forces

시간 제한2초메모리 제한1024 MB

요약
3의 배수인 n명의 배달원을 세 명씩 짝지어 각 팀 중간값의 합이 최대가 되도록 나눈다.
난이도

보통10점 중 6점

유형
그리디, 정렬, 배열
정답자
아직 제출이 없습니다

문제

Gry finally becomes the Executive Courier Officer in "Universe Express". He has nn subordinate couriers with some delivery strength f_if\_i. The delivery strength of a team of three people is the median of their strength, i.e., the middle element after the sorting. Please help Gry to split the couriers into kk teams of three people in order to maximize the total delivery strength of "Universe Express". The total strength is the sum of the strength of these kk teams.

입력

  • One line containing the number of couriers in the company, nn (1≤n≤1061 \leq n \leq 10^6), where nn is a multiple of 33.
  • One line containing the strengths of the nn couriers f_1f\_1 …\ldots f_nf\_n (1≤f≤1061 \le f \le 10^6).

출력

The sole line of the output should contain the maximal strength of "Universe Express".

예제2

  1. 예제 1

    입력
    3
    1 2 3
    
    예상 출력
    2
    
  2. 예제 2

    입력
    6
    5 6 2 3 1 4
    
    예상 출력
    8