結果

問題 No.1792 科学の甲子園
ユーザー 👑 H20H20
提出日時 2021-12-21 00:43:58
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 119 ms / 4,000 ms
コード長 1,258 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 78,176 KB
最終ジャッジ日時 2023-08-17 18:41:21
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,228 KB
testcase_01 AC 73 ms
71,608 KB
testcase_02 AC 76 ms
71,436 KB
testcase_03 AC 76 ms
71,580 KB
testcase_04 AC 77 ms
71,368 KB
testcase_05 AC 76 ms
71,292 KB
testcase_06 AC 75 ms
71,612 KB
testcase_07 AC 76 ms
71,388 KB
testcase_08 AC 89 ms
76,404 KB
testcase_09 AC 84 ms
76,216 KB
testcase_10 AC 73 ms
71,364 KB
testcase_11 AC 119 ms
78,164 KB
testcase_12 AC 110 ms
77,716 KB
testcase_13 AC 114 ms
77,976 KB
testcase_14 AC 118 ms
78,100 KB
testcase_15 AC 114 ms
77,716 KB
testcase_16 AC 76 ms
71,324 KB
testcase_17 AC 76 ms
71,492 KB
testcase_18 AC 74 ms
71,324 KB
testcase_19 AC 110 ms
78,176 KB
testcase_20 AC 118 ms
77,868 KB
testcase_21 AC 109 ms
77,712 KB
testcase_22 AC 116 ms
78,076 KB
testcase_23 AC 116 ms
77,688 KB
testcase_24 AC 73 ms
71,300 KB
testcase_25 AC 73 ms
71,352 KB
testcase_26 AC 73 ms
71,316 KB
testcase_27 AC 117 ms
78,136 KB
testcase_28 AC 116 ms
78,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())
ALL = []
MIPCBE = [0]*6
for _ in range(N):
    L = list(map(int, input().split()))
    ALL.append(L)
    for i in range(6):
        MIPCBE[i] = max(MIPCBE[i],L[i])

ans = 0
for l in list(itertools.combinations(range(6), 3)):
    OTHER = list(range(6))
    for i in l:
        OTHER.remove(i)
    v = 1
    for o in OTHER:
        v *= MIPCBE[o]
    v2 = 1
    for mipcbe in ALL:
        temp=1
        for i in l:
            temp*=mipcbe[i]
        v2 = max(temp,v2)
    ans = max(ans,v*v2)

for l in list(itertools.combinations(range(6), 4)):
    OTHER = list(range(6))
    for i in l:
        OTHER.remove(i)
    v = 1
    for o in OTHER:
        v *= MIPCBE[o]

    for i in range(1,4):
        l1 = [0,i]
        l2 = []
        for j in range(1,4):
            if j not in l1:
                l2.append(j)
        ll1 = [l[l1[0]],l[l1[1]]]
        ll2 = [l[l2[0]],l[l2[1]]]

        v2 = 1
        for mipcbe in ALL:
            temp=1
            for i in ll1:
                temp*=mipcbe[i]
            v2 = max(temp,v2)

        v3 = 1
        for mipcbe in ALL:
            temp=1
            for i in ll2:
                temp*=mipcbe[i]
            v3 = max(temp,v3)
        ans = max(ans,v*v2*v3)

print(ans)
0