結果

問題 No.1792 科学の甲子園
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-12-23 23:15:28
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 125 ms / 4,000 ms
コード長 1,524 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 77,740 KB
最終ジャッジ日時 2023-08-17 18:41:58
合計ジャッジ時間 4,539 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,020 KB
testcase_01 AC 76 ms
71,128 KB
testcase_02 AC 82 ms
71,176 KB
testcase_03 AC 78 ms
71,404 KB
testcase_04 AC 78 ms
71,240 KB
testcase_05 AC 77 ms
71,252 KB
testcase_06 AC 72 ms
71,300 KB
testcase_07 AC 75 ms
71,304 KB
testcase_08 AC 84 ms
76,616 KB
testcase_09 AC 85 ms
75,924 KB
testcase_10 AC 74 ms
71,136 KB
testcase_11 AC 110 ms
77,444 KB
testcase_12 AC 104 ms
77,040 KB
testcase_13 AC 111 ms
77,520 KB
testcase_14 AC 121 ms
77,520 KB
testcase_15 AC 112 ms
77,300 KB
testcase_16 AC 81 ms
71,200 KB
testcase_17 AC 82 ms
71,340 KB
testcase_18 AC 82 ms
71,408 KB
testcase_19 AC 112 ms
77,400 KB
testcase_20 AC 123 ms
77,424 KB
testcase_21 AC 115 ms
77,216 KB
testcase_22 AC 122 ms
77,348 KB
testcase_23 AC 119 ms
77,740 KB
testcase_24 AC 77 ms
71,440 KB
testcase_25 AC 81 ms
71,340 KB
testcase_26 AC 83 ms
71,128 KB
testcase_27 AC 123 ms
77,108 KB
testcase_28 AC 125 ms
77,392 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