結果

問題 No.1792 科学の甲子園
ユーザー lloyzlloyz
提出日時 2022-12-17 03:15:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 4,000 ms
コード長 702 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 73,600 KB
最終ジャッジ日時 2024-05-05 01:32:46
合計ジャッジ時間 3,167 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
63,616 KB
testcase_01 AC 60 ms
63,744 KB
testcase_02 AC 58 ms
62,848 KB
testcase_03 AC 61 ms
64,128 KB
testcase_04 AC 60 ms
63,744 KB
testcase_05 AC 61 ms
63,488 KB
testcase_06 AC 62 ms
62,592 KB
testcase_07 AC 58 ms
62,720 KB
testcase_08 AC 64 ms
65,280 KB
testcase_09 AC 65 ms
65,152 KB
testcase_10 AC 55 ms
64,000 KB
testcase_11 AC 85 ms
71,552 KB
testcase_12 AC 80 ms
70,656 KB
testcase_13 AC 84 ms
71,168 KB
testcase_14 AC 90 ms
73,472 KB
testcase_15 AC 81 ms
70,272 KB
testcase_16 AC 58 ms
62,848 KB
testcase_17 AC 62 ms
64,128 KB
testcase_18 AC 62 ms
64,000 KB
testcase_19 AC 80 ms
70,272 KB
testcase_20 AC 89 ms
73,344 KB
testcase_21 AC 74 ms
70,400 KB
testcase_22 AC 77 ms
71,680 KB
testcase_23 AC 71 ms
70,016 KB
testcase_24 AC 57 ms
62,848 KB
testcase_25 AC 55 ms
62,848 KB
testcase_26 AC 53 ms
62,976 KB
testcase_27 AC 76 ms
70,912 KB
testcase_28 AC 87 ms
73,600 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