PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000053. Tuyển đội thi ICPC (ICPC Team Selection)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tuyển đội thi ICPC (ICPC Team Selection)
ICPC Team Selection
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
There are students of skills , to be split into teams of exactly three. Each team score is the median skill of its three members. Maximize the total team score.
Input
Line 1: , the number of teams. Line 2: skills .
Output
Print the maximum sum of team scores.
Subtasks
- Subtask 1 (20 points): ; for every .
- Subtask 2 (30 points): ; for every .
- Subtask 3 (50 points): ; for every .
Examples
Input
3
4 4 4 10 10 10 99 99 99
Output
119
Explanation
Form teams , and . Their medians are 99, 10, 10; total 119, compared with 113 for three consecutive blocks.