結果

問題 No.1792 科学の甲子園
ユーザー chineristACchineristAC
提出日時 2021-12-21 00:20:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 221 ms / 4,000 ms
コード長 883 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 81,692 KB
最終ジャッジ日時 2023-08-17 18:41:16
合計ジャッジ時間 5,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
79,740 KB
testcase_01 AC 130 ms
79,472 KB
testcase_02 AC 123 ms
79,144 KB
testcase_03 AC 128 ms
79,168 KB
testcase_04 AC 126 ms
79,692 KB
testcase_05 AC 125 ms
79,048 KB
testcase_06 AC 126 ms
79,352 KB
testcase_07 AC 125 ms
79,084 KB
testcase_08 AC 129 ms
79,748 KB
testcase_09 AC 135 ms
79,568 KB
testcase_10 AC 128 ms
79,736 KB
testcase_11 AC 221 ms
81,636 KB
testcase_12 AC 158 ms
81,328 KB
testcase_13 AC 178 ms
81,536 KB
testcase_14 AC 172 ms
81,508 KB
testcase_15 AC 166 ms
81,396 KB
testcase_16 AC 122 ms
79,188 KB
testcase_17 AC 126 ms
79,536 KB
testcase_18 AC 126 ms
79,456 KB
testcase_19 AC 168 ms
81,692 KB
testcase_20 AC 182 ms
81,640 KB
testcase_21 AC 167 ms
81,644 KB
testcase_22 AC 179 ms
81,636 KB
testcase_23 AC 159 ms
81,580 KB
testcase_24 AC 122 ms
79,296 KB
testcase_25 AC 121 ms
79,372 KB
testcase_26 AC 125 ms
79,180 KB
testcase_27 AC 172 ms
81,624 KB
testcase_28 AC 173 ms
81,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
dp = [[0 for j in range(5)] for i in range(1<<6)]
for j in range(5):
    dp[0][j] = 1
for i in range(N):
    A = li()
    P = [0 for S in range(1<<6)]
    P[0] = 1
    for j in range(6):
        for S in range(1<<j,2<<j):
            P[S] = P[S-(1<<j)] * A[j]
    
    for S in range(1<<6)[::-1]:
        for j in range(4)[::-1]:
            T = (1<<6) -1- S
            if not dp[S][j]:
                continue
            tmp = T
            while tmp:
                dp[S+tmp][j+1] = max(dp[S+tmp][j+1],dp[S][j]*P[tmp])
                tmp = (tmp-1)&T
    
    #print(dp)

print(dp[-1][4])
0