atcoder#ZONE2021C. MAD TEAM
MAD TEAM
Score : points
Problem Statement
You want to choose three persons from candidates to form a team. Each candidate has five parameters: power, speed, technique, knowledge, and inventiveness. The power, speed, technique, knowledge, and the inventiveness of the -th candidate are , , , , and , respectively. Let us define your team's power as the maximum of the members' powers. The team's speed, technique, knowledge, and inventiveness are defined similarly. Then, let us define your team's total strength as the minimum of the team's power, speed, technique, knowledge, and inventiveness. Find the maximum possible value of your team's total strength.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3
3 9 6 4 6
6 9 3 1 1
8 8 9 3 7
4
We have no choice but to choose all three of them. Then, the team's parameters will be as follows:
- power: ;
- speed: ;
- technique: ;
- knowledge: ;
- inventiveness: .
Thus, the team's total strength will be .
5
6 13 6 19 11
4 4 12 11 18
20 7 19 2 5
15 5 12 20 7
8 7 6 18 5
13
If we choose the -st, -nd, and -rd candidates, the team's total strength will be .
10
6 7 5 18 2
3 8 1 6 3
7 2 8 7 7
6 3 3 4 7
12 8 9 15 9
9 8 6 1 10
12 9 7 8 2
10 3 17 4 10
3 1 3 19 3
3 14 7 13 1
10