結果

問題 No.1792 科学の甲子園
ユーザー titiatitia
提出日時 2021-12-22 02:03:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 446 ms / 4,000 ms
コード長 5,066 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 14,208 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-26 17:56:19
合計ジャッジ時間 5,851 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
11,904 KB
testcase_01 AC 40 ms
12,032 KB
testcase_02 AC 37 ms
12,032 KB
testcase_03 AC 39 ms
12,160 KB
testcase_04 AC 39 ms
12,032 KB
testcase_05 AC 38 ms
11,904 KB
testcase_06 AC 37 ms
12,032 KB
testcase_07 AC 37 ms
11,904 KB
testcase_08 AC 47 ms
12,160 KB
testcase_09 AC 63 ms
11,904 KB
testcase_10 AC 40 ms
12,032 KB
testcase_11 AC 338 ms
12,160 KB
testcase_12 AC 242 ms
12,288 KB
testcase_13 AC 315 ms
12,160 KB
testcase_14 AC 441 ms
12,416 KB
testcase_15 AC 253 ms
12,160 KB
testcase_16 AC 37 ms
12,160 KB
testcase_17 AC 40 ms
11,904 KB
testcase_18 AC 39 ms
12,160 KB
testcase_19 AC 254 ms
12,416 KB
testcase_20 AC 446 ms
12,288 KB
testcase_21 AC 221 ms
12,288 KB
testcase_22 AC 332 ms
12,288 KB
testcase_23 AC 257 ms
12,160 KB
testcase_24 AC 37 ms
11,904 KB
testcase_25 AC 38 ms
12,032 KB
testcase_26 AC 37 ms
11,904 KB
testcase_27 AC 331 ms
12,416 KB
testcase_28 AC 436 ms
12,288 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