No.1792 Science Koshien
タグ : / 解いたユーザー数 51
作問者 :
Problem Statement
You are a teacher at a local high school. You are now going to choose $4$ of $N$ students to enter a competition called the Science Koshien.
In the Science Koshien, exams are held in 6 subjects: physics, chemistry, biology, earth science, mathematics, and informatics.
The aptitude values of the $i$-th student in each subject are $M_i$ for mathematics, $I_i$ for informatics, $P_i$ for physics, $C_i$ for chemistry, $B_i$ for biology, and $E_i$ for earth science.
The team's ability in each subject is the maximum of the aptitude values of the 4 students in that subject.
In the Science Koshien of your prefecture, the score is the product of the abilities in all subjects.
What is the maximum score you can get?
Input
$N$ $M_1\ I_1\ P_1\ C_1\ B_1\ E_1$ $\vdots$ $M_N\ I_N\ P_N\ C_N\ B_N\ E_N$
Output
Output the answer on one line. End the output with a newline.
Sample
Sample 1
Input
8 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 1 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7
Output
367416
By choosing the 1st, 3rd, 6th, and 8th students, the abilities in the subjects can be made 9,7,9,9,8,9.
Sample 2
Input
11 27 18 28 18 28 45 90 45 23 53 60 28 74 71 35 26 62 49 77 57 24 70 93 69 99 59 57 49 66 96 76 27 72 40 76 6 30 35 35 47 59 45 71 38 21 78 52 51 66 42 74 27 46 6 39 19 32 1 1 30 59 92 18 17 41 35
Output
421218040320
It is optimal to hire the 4th, 5th, 9th, and 11th students.
Sample 3
Input
4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 100 100 100 100 100 100
Output
1000000000000
Since there are only 4 students, you have no choice but to take all of them.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。