結果

問題 No.1792 科学の甲子園
ユーザー titiatitia
提出日時 2021-12-22 02:03:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 4,000 ms
コード長 5,080 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 77,184 KB
最終ジャッジ日時 2024-05-05 01:31:16
合計ジャッジ時間 3,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
68,352 KB
testcase_01 AC 69 ms
68,864 KB
testcase_02 AC 51 ms
61,696 KB
testcase_03 AC 56 ms
64,128 KB
testcase_04 AC 69 ms
68,864 KB
testcase_05 AC 55 ms
64,128 KB
testcase_06 AC 55 ms
63,104 KB
testcase_07 AC 52 ms
61,184 KB
testcase_08 AC 93 ms
76,416 KB
testcase_09 AC 90 ms
76,032 KB
testcase_10 AC 74 ms
70,272 KB
testcase_11 AC 110 ms
76,416 KB
testcase_12 AC 96 ms
76,544 KB
testcase_13 AC 104 ms
76,672 KB
testcase_14 AC 114 ms
76,928 KB
testcase_15 AC 115 ms
76,544 KB
testcase_16 AC 55 ms
62,976 KB
testcase_17 AC 72 ms
68,992 KB
testcase_18 AC 74 ms
69,760 KB
testcase_19 AC 102 ms
76,544 KB
testcase_20 AC 116 ms
76,928 KB
testcase_21 AC 95 ms
76,544 KB
testcase_22 AC 100 ms
76,544 KB
testcase_23 AC 100 ms
76,800 KB
testcase_24 AC 46 ms
61,440 KB
testcase_25 AC 50 ms
63,104 KB
testcase_26 AC 54 ms
62,848 KB
testcase_27 AC 107 ms
76,928 KB
testcase_28 AC 127 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 解説を見たら当たり前に見えた。こういう問題は解かないと……。

N=int(input())
A=[list(map(int,input().split())) for i in range(N)]

ANS=set()
def dfs(A):
    #print(A)
    if len(A)==4:
        ANS.add(tuple(sorted(A)))
        return

    B=[]
    for to in A:
        for z in to:
            B.append(z)

    for i in range(1,1<<6):
        X=[]
        for j in range(6):
            if i & (1<<j) != 0 and not(j in B):
                X.append(j)
        X.sort()

        if len(X)>0:
            dfs(A+(tuple(X),))

#dfs(tuple())

ANS={((0, 2), (1, 5), (3,), (4,)), ((0, 4), (1, 2), (3,), (5,)), ((0, 1), (2, 3), (4,), (5,)), ((0,), (1, 5), (2,), (3, 4)), ((0, 3), (1,), (2,), (4, 5)), ((0, 1), (2,), (3,), (5,)), ((0,), (2,), (3,), (4,)), ((0, 2), (1,), (3,), (4,)), ((0, 5), (1,), (2, 3), (4,)), ((0,), (1, 2), (3, 5), (4,)), ((0,), (2,), (3,), (4, 5)), ((0, 2), (1,), (3,), (4, 5)), ((0, 5), (1,), (2,), (3,)), ((0, 1), (2, 5), (3,), (4,)), ((0, 5), (1, 4), (2,), (3,)), ((0,), (1,), (2, 5), (3, 4)), ((1,), (2, 3), (4,), (5,)), ((0, 4), (1, 5), (2,), (3,)), ((0,), (1, 3), (2, 5), (4,)), ((0, 4, 5), (1,), (2,), (3,)), ((0, 1), (2,), (4,), (5,)), ((0,), (1,), (2,), (3,)), ((2,), (3,), (4,), (5,)), ((0,), (1,), (2, 3, 4), (5,)), ((0,), (1,), (2, 4), (3,)), ((0,), (1, 5), (2, 4), (3,)), ((0, 1, 4), (2,), (3,), (5,)), ((0,), (1,), (2,), (4, 5)), ((0,), (3,), (4,), (5,)), ((0,), (1, 4), (2,), (3, 5)), ((0,), (1, 2), (3,), (5,)), ((0, 2), (1,), (4,), (5,)), ((0, 3), (1,), (2,), (4,)), ((1,), (2,), (3,), (4,)), ((0, 3), (1, 5), (2,), (4,)), ((0, 2, 5), (1,), (3,), (4,)), ((0, 1, 3), (2,), (4,), (5,)), ((0, 4), (1,), (3,), (5,)), ((1,), (2,), (3,), (4, 5)), ((0,), (2,), (3, 4), (5,)), ((0, 3, 5), (1,), (2,), (4,)), ((0, 2), (1,), (3, 4), (5,)), ((0,), (1, 2, 5), (3,), (4,)), ((0,), (1,), (2,), (3, 5)), ((0, 4), (2,), (3,), (5,)), ((0, 3), (1, 4), (2,), (5,)), ((1, 4), (2,), (3,), (5,)), ((0,), (1,), (2, 3), (4,)), ((0, 3), (1,), (2,), (5,)), ((0,), (1, 3), (4,), (5,)), ((0,), (1, 2), (3, 4), (5,)), ((0,), (1, 2), (4,), (5,)), ((0, 5), (1,), (2,), (4,)), ((0,), (1,), (2, 3), (4, 5)), ((0, 3), (1,), (2, 5), (4,)), ((0, 4), (1,), (2, 5), (3,)), ((0, 2), (1, 3), (4,), (5,)), ((0, 5), (1, 2), (3,), (4,)), ((0,), (1, 5), (2,), (3,)), ((0,), (2,), (3,), (5,)), ((0, 2), (1,), (3,), (5,)), ((0, 3), (1,), (2, 4), (5,)), ((0,), (1, 4), (2, 3), (5,)), ((0, 5), (1,), (3,), (4,)), ((0, 4), (1,), (2,), (5,)), ((0,), (1,), (2,), (4,)), ((0, 5), (2,), (3,), (4,)), ((0,), (2,), (3, 5), (4,)), ((0,), (1, 4), (2,), (5,)), ((0,), (1,), (3,), (4, 5)), ((0,), (1, 3, 4), (2,), (5,)), ((1,), (2, 5), (3,), (4,)), ((0,), (1,), (2, 5), (3,)), ((0,), (2,), (4,), (5,)), ((0,), (1,), (2, 5), (4,)), ((0, 2), (3,), (4,), (5,)), ((0,), (1,), (2,), (5,)), ((0,), (1, 4, 5), (2,), (3,)), ((0,), (1, 3), (2,), (4, 5)), ((0,), (1, 5), (2, 3), (4,)), ((1,), (2, 4), (3,), (5,)), ((0, 4), (1,), (2,), (3,)), ((0,), (1, 2, 3), (4,), (5,)), ((0, 2, 4), (1,), (3,), (5,)), ((0,), (1,), (2, 4), (3, 5)), ((0, 1, 5), (2,), (3,), (4,)), ((0, 3, 4), (1,), (2,), (5,)), ((1,), (2,), (3,), (5,)), ((0,), (1,), (2,), (3, 4, 5)), ((0, 1), (2,), (3,), (4,)), ((0, 3), (1, 2), (4,), (5,)), ((0,), (1, 5), (2,), (4,)), ((0,), (1,), (2, 4, 5), (3,)), ((0, 1), (2,), (3,), (4, 5)), ((1,), (2,), (3, 5), (4,)), ((0,), (1,), (2, 3), (5,)), ((0, 5), (1,), (2,), (3, 4)), ((0, 1, 2), (3,), (4,), (5,)), ((0,), (1,), (3,), (4,)), ((0,), (1,), (3, 4), (5,)), ((0, 4), (1,), (2,), (3, 5)), ((1,), (2,), (3, 4), (5,)), ((1, 5), (2,), (3,), (4,)), ((0,), (2, 3), (4,), (5,)), ((1,), (2,), (4,), (5,)), ((0,), (1, 2, 4), (3,), (5,)), ((0, 1), (2, 4), (3,), (5,)), ((0,), (1,), (2,), (3, 4)), ((0, 2, 3), (1,), (4,), (5,)), ((0, 3), (1,), (4,), (5,)), ((0,), (1, 3), (2,), (4,)), ((0,), (1, 4), (3,), (5,)), ((0,), (1, 3, 5), (2,), (4,)), ((0,), (1,), (3,), (5,)), ((0, 3), (2,), (4,), (5,)), ((0, 5), (1, 3), (2,), (4,)), ((0,), (1,), (2, 4), (5,)), ((0, 2), (1, 4), (3,), (5,)), ((0,), (1, 4), (2,), (3,)), ((0, 1), (2,), (3, 5), (4,)), ((1, 2), (3,), (4,), (5,)), ((0, 1), (3,), (4,), (5,)), ((0,), (1, 2), (3,), (4,)), ((0,), (1,), (2, 3, 5), (4,)), ((1,), (3,), (4,), (5,)), ((0,), (1, 4), (2, 5), (3,)), ((0, 5), (1,), (2, 4), (3,)), ((0,), (1,), (3, 5), (4,)), ((0,), (1, 3), (2,), (5,)), ((0, 4), (1, 3), (2,), (5,)), ((0, 4), (1,), (2, 3), (5,)), ((0,), (1, 2), (3,), (4, 5)), ((0, 2), (1,), (3, 5), (4,)), ((0, 1), (2,), (3, 4), (5,)), ((0,), (2, 4), (3,), (5,)), ((1, 3), (2,), (4,), (5,)), ((0,), (1,), (4,), (5,)), ((0,), (1, 5), (3,), (4,)), ((0,), (2, 5), (3,), (4,)), ((0,), (1, 3), (2, 4), (5,))}


LANS=0
for x,y,z,w in ANS:
    AX=1
    BX=1
    CX=1
    DX=1
    
    for i in range(N):
        C=1
        for to in x:
            C*=A[i][to]
        AX=max(AX,C)

        D=1
        for to in y:
            D*=A[i][to]
        BX=max(BX,D)

        E=1
        for to in z:
            E*=A[i][to]
        CX=max(CX,E)

        F=1
        for to in w:
            F*=A[i][to]
        DX=max(DX,F)

    LANS=max(LANS,AX*BX*CX*DX)

print(LANS)
            
0