結果

問題 No.1792 科学の甲子園
ユーザー lloyzlloyz
提出日時 2022-12-17 03:15:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 4,000 ms
コード長 702 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,744 KB
最終ジャッジ日時 2023-08-17 18:42:42
合計ジャッジ時間 4,388 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,100 KB
testcase_01 AC 91 ms
76,664 KB
testcase_02 AC 89 ms
76,548 KB
testcase_03 AC 91 ms
76,416 KB
testcase_04 AC 86 ms
76,460 KB
testcase_05 AC 86 ms
76,476 KB
testcase_06 AC 85 ms
76,468 KB
testcase_07 AC 86 ms
76,464 KB
testcase_08 AC 93 ms
76,672 KB
testcase_09 AC 94 ms
76,484 KB
testcase_10 AC 89 ms
76,564 KB
testcase_11 AC 104 ms
76,732 KB
testcase_12 AC 103 ms
76,904 KB
testcase_13 AC 107 ms
76,636 KB
testcase_14 AC 113 ms
77,496 KB
testcase_15 AC 106 ms
76,772 KB
testcase_16 AC 88 ms
76,380 KB
testcase_17 AC 92 ms
76,560 KB
testcase_18 AC 91 ms
76,548 KB
testcase_19 AC 105 ms
76,796 KB
testcase_20 AC 113 ms
77,744 KB
testcase_21 AC 100 ms
76,872 KB
testcase_22 AC 103 ms
76,752 KB
testcase_23 AC 99 ms
76,980 KB
testcase_24 AC 86 ms
76,624 KB
testcase_25 AC 87 ms
76,396 KB
testcase_26 AC 87 ms
76,576 KB
testcase_27 AC 107 ms
76,856 KB
testcase_28 AC 116 ms
77,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
M = [list(map(int, input().split())) for _ in range(n)]

DP = [0 for _ in range(1 << 6)]
for bit in range(1 << 6):
    L = []
    for i in range(6):
        if (bit >> i) & 1:
            L.append(i)
    for i in range(n):
        res = 1
        for j in L:
            res *= M[i][j]
        DP[bit] = max(DP[bit], res)

ans = 0
max_bit = (1 << 6) - 1
for bit1 in range(1 << 6):
    for bit2 in range(1 << 6):
        if bit1 & bit2:
            continue
        for bit3 in range(1 << 6):
            if (bit1 | bit2) & bit3:
                continue
            bit4 = max_bit ^ (bit1 | bit2 | bit3)
            ans = max(ans, DP[bit1] * DP[bit2] * DP[bit3] * DP[bit4])
print(ans)
0