結果

問題 No.1792 科学の甲子園
ユーザー 👑 KazunKazun
提出日時 2021-12-24 04:07:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 4,000 ms
コード長 485 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 70,144 KB
最終ジャッジ日時 2024-05-05 01:31:55
合計ジャッジ時間 2,507 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
62,976 KB
testcase_01 AC 58 ms
63,616 KB
testcase_02 AC 46 ms
61,696 KB
testcase_03 AC 47 ms
62,720 KB
testcase_04 AC 49 ms
62,976 KB
testcase_05 AC 46 ms
62,336 KB
testcase_06 AC 46 ms
61,952 KB
testcase_07 AC 44 ms
61,440 KB
testcase_08 AC 48 ms
63,104 KB
testcase_09 AC 51 ms
63,616 KB
testcase_10 AC 49 ms
63,232 KB
testcase_11 AC 69 ms
69,120 KB
testcase_12 AC 60 ms
67,968 KB
testcase_13 AC 61 ms
69,248 KB
testcase_14 AC 61 ms
70,144 KB
testcase_15 AC 58 ms
67,968 KB
testcase_16 AC 48 ms
62,080 KB
testcase_17 AC 50 ms
62,848 KB
testcase_18 AC 51 ms
62,976 KB
testcase_19 AC 62 ms
67,968 KB
testcase_20 AC 64 ms
70,144 KB
testcase_21 AC 60 ms
68,096 KB
testcase_22 AC 61 ms
69,504 KB
testcase_23 AC 63 ms
67,712 KB
testcase_24 AC 47 ms
61,440 KB
testcase_25 AC 48 ms
61,952 KB
testcase_26 AC 49 ms
62,080 KB
testcase_27 AC 63 ms
68,352 KB
testcase_28 AC 62 ms
70,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import product

input=sys.stdin.readline
N=int(input())

K=6
P=[0]*(2**K)

for i in range(N):
    S=list(map(int,input().split()))

    for E in range(2**K):
        F=E
        p=1
        for k in range(K):
            if E&1==1:
                p*=S[k]
            E>>=1

        P[F]=max(P[F],p)

X=0
for A in product(range(4),repeat=K):
    B=[0,0,0,0]
    for k in range(K):
        B[A[k]]|=1<<k

    X=max(X,P[B[0]]*P[B[1]]*P[B[2]]*P[B[3]])

print(X)
0