結果

問題 No.1792 科学の甲子園
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-12-23 23:15:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 4,000 ms
コード長 1,524 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 74,112 KB
最終ジャッジ日時 2024-05-05 01:31:25
合計ジャッジ時間 2,587 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,480 KB
testcase_01 AC 38 ms
53,120 KB
testcase_02 AC 39 ms
52,480 KB
testcase_03 AC 37 ms
52,608 KB
testcase_04 AC 38 ms
52,480 KB
testcase_05 AC 37 ms
52,224 KB
testcase_06 AC 37 ms
52,352 KB
testcase_07 AC 38 ms
52,736 KB
testcase_08 AC 49 ms
61,312 KB
testcase_09 AC 50 ms
61,824 KB
testcase_10 AC 38 ms
52,480 KB
testcase_11 AC 78 ms
72,960 KB
testcase_12 AC 74 ms
70,528 KB
testcase_13 AC 86 ms
73,472 KB
testcase_14 AC 87 ms
73,856 KB
testcase_15 AC 79 ms
71,040 KB
testcase_16 AC 43 ms
52,352 KB
testcase_17 AC 38 ms
52,864 KB
testcase_18 AC 37 ms
52,608 KB
testcase_19 AC 72 ms
72,064 KB
testcase_20 AC 79 ms
74,112 KB
testcase_21 AC 78 ms
71,808 KB
testcase_22 AC 79 ms
72,576 KB
testcase_23 AC 74 ms
72,448 KB
testcase_24 AC 37 ms
52,480 KB
testcase_25 AC 42 ms
52,608 KB
testcase_26 AC 39 ms
52,608 KB
testcase_27 AC 81 ms
71,808 KB
testcase_28 AC 89 ms
73,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

まとめる

"""

import sys
from sys import stdin

N = int(stdin.readline())

C = [list(map(int,stdin.readline().split())) for i in range(N)]

ans = 0

for b in range(6):

    for a in range(b):

        rem = [i for i in range(6)]
        del rem[b]
        del rem[a]

        amax = 0
        for i in range(N):
            amax = max(amax , C[i][a])
        bmax = 0
        for i in range(N):
            bmax = max(bmax , C[i][b])

        for c,d in [ [(rem[0],rem[1]),(rem[2],rem[3])]
                     , [(rem[0],rem[2]),(rem[1],rem[3])]
                     , [(rem[0],rem[3]),(rem[1],rem[2])] ]:

            cmax = 0
            for i in range(N):
                cmax = max(cmax , C[i][c[0]] * C[i][c[1]])

            dmax = 0
            for i in range(N):
                dmax = max(dmax , C[i][d[0]] * C[i][d[1]])

            nans = amax * bmax * cmax * dmax
            if ans < nans:
                #print (a,b,c,d)
                #print (amax,bmax,cmax,dmax,nans)
                ans = nans

for a3 in range(6):
    for a2 in range(a3):
        for a1 in range(a2):

            amax = 0
            for i in range(N):
                amax = max(amax , C[i][a1] * C[i][a2] * C[i][a3])

            tans = amax
            for i in range(6):
                if i in (a1,a2,a3):
                    continue
                nmax = 0
                for j in range(N):
                    nmax = max(nmax , C[j][i])
                tans *= nmax

            ans = max(ans , tans)

print (ans)
0