結果

問題 No.1792 科学の甲子園
ユーザー 👑 rin204rin204
提出日時 2022-01-21 01:25:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 4,000 ms
コード長 706 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 77,732 KB
最終ジャッジ日時 2023-08-17 18:42:26
合計ジャッジ時間 4,353 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
76,568 KB
testcase_01 AC 89 ms
76,272 KB
testcase_02 AC 86 ms
76,556 KB
testcase_03 AC 90 ms
76,720 KB
testcase_04 AC 89 ms
76,560 KB
testcase_05 AC 90 ms
76,724 KB
testcase_06 AC 88 ms
76,656 KB
testcase_07 AC 88 ms
76,152 KB
testcase_08 AC 94 ms
76,440 KB
testcase_09 AC 94 ms
76,496 KB
testcase_10 AC 90 ms
76,420 KB
testcase_11 AC 110 ms
76,844 KB
testcase_12 AC 106 ms
76,688 KB
testcase_13 AC 108 ms
76,708 KB
testcase_14 AC 117 ms
77,616 KB
testcase_15 AC 107 ms
76,788 KB
testcase_16 AC 88 ms
76,380 KB
testcase_17 AC 92 ms
76,236 KB
testcase_18 AC 91 ms
76,560 KB
testcase_19 AC 106 ms
77,100 KB
testcase_20 AC 115 ms
77,732 KB
testcase_21 AC 105 ms
77,052 KB
testcase_22 AC 110 ms
76,720 KB
testcase_23 AC 108 ms
76,800 KB
testcase_24 AC 87 ms
76,632 KB
testcase_25 AC 90 ms
76,500 KB
testcase_26 AC 86 ms
76,408 KB
testcase_27 AC 108 ms
76,956 KB
testcase_28 AC 121 ms
77,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

P = [0] * (1 << 6)
for bit in range(1 << 6):
    lst = []
    for i in range(6):
        if bit >> i & 1:
            lst.append(i)
    
    for i in range(n):
        prod = 1
        for j in lst:
            prod *= mip[i][j]
        P[bit] = max(P[bit], prod)
    
max_ = (1 << 6) - 1
for bit1 in range(1 << 6):
    for bit2 in range(1 << 6):
        if bit1 & bit2 != 0:
            continue
        for bit3 in range(1 << 6):
            if (bit1 | bit2) & bit3 != 0:
                continue
            bit4 = max_ ^ (bit1 | bit2 | bit3)
            ans = max(ans, P[bit1] * P[bit2] * P[bit3] * P[bit4])
print(ans)
0