結果

問題 No.1792 科学の甲子園
ユーザー 👑 H20H20
提出日時 2021-12-21 00:43:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 4,000 ms
コード長 1,258 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-05-05 01:29:19
合計ジャッジ時間 2,627 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,736 KB
testcase_01 AC 39 ms
53,120 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 39 ms
52,352 KB
testcase_04 AC 37 ms
52,864 KB
testcase_05 AC 37 ms
52,608 KB
testcase_06 AC 37 ms
52,736 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 55 ms
63,872 KB
testcase_09 AC 51 ms
62,336 KB
testcase_10 AC 38 ms
52,864 KB
testcase_11 AC 87 ms
76,928 KB
testcase_12 AC 74 ms
71,936 KB
testcase_13 AC 85 ms
76,800 KB
testcase_14 AC 87 ms
76,928 KB
testcase_15 AC 77 ms
74,496 KB
testcase_16 AC 38 ms
52,608 KB
testcase_17 AC 39 ms
52,608 KB
testcase_18 AC 37 ms
53,120 KB
testcase_19 AC 79 ms
74,240 KB
testcase_20 AC 91 ms
76,928 KB
testcase_21 AC 77 ms
72,192 KB
testcase_22 AC 86 ms
77,056 KB
testcase_23 AC 78 ms
74,496 KB
testcase_24 AC 38 ms
52,480 KB
testcase_25 AC 37 ms
52,352 KB
testcase_26 AC 37 ms
52,864 KB
testcase_27 AC 83 ms
75,392 KB
testcase_28 AC 90 ms
77,056 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