結果

問題 No.2389 Cheating Code Golf
ユーザー mymelochanmymelochan
提出日時 2023-07-21 22:52:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 1,106 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 77,272 KB
最終ジャッジ日時 2023-10-21 22:56:26
合計ジャッジ時間 4,747 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,472 KB
testcase_01 AC 42 ms
55,472 KB
testcase_02 AC 72 ms
70,568 KB
testcase_03 AC 114 ms
77,272 KB
testcase_04 AC 113 ms
77,252 KB
testcase_05 AC 56 ms
66,464 KB
testcase_06 AC 42 ms
55,472 KB
testcase_07 AC 59 ms
68,520 KB
testcase_08 AC 78 ms
72,600 KB
testcase_09 AC 42 ms
55,472 KB
testcase_10 AC 51 ms
64,148 KB
testcase_11 AC 61 ms
68,512 KB
testcase_12 AC 43 ms
55,472 KB
testcase_13 AC 71 ms
70,568 KB
testcase_14 AC 63 ms
70,556 KB
testcase_15 AC 51 ms
64,308 KB
testcase_16 AC 74 ms
72,600 KB
testcase_17 AC 43 ms
55,472 KB
testcase_18 AC 64 ms
68,492 KB
testcase_19 AC 42 ms
55,472 KB
testcase_20 AC 49 ms
64,024 KB
testcase_21 AC 58 ms
66,384 KB
testcase_22 AC 52 ms
66,376 KB
testcase_23 AC 40 ms
55,472 KB
testcase_24 AC 58 ms
68,480 KB
testcase_25 AC 54 ms
66,384 KB
testcase_26 AC 51 ms
64,364 KB
testcase_27 AC 63 ms
70,560 KB
testcase_28 AC 62 ms
68,492 KB
testcase_29 AC 54 ms
64,364 KB
testcase_30 AC 70 ms
68,520 KB
testcase_31 AC 58 ms
66,464 KB
testcase_32 AC 43 ms
55,472 KB
testcase_33 AC 43 ms
55,472 KB
testcase_34 AC 65 ms
70,540 KB
testcase_35 AC 55 ms
66,464 KB
testcase_36 AC 65 ms
68,520 KB
testcase_37 AC 57 ms
64,364 KB
testcase_38 AC 82 ms
73,072 KB
testcase_39 AC 42 ms
55,472 KB
testcase_40 AC 50 ms
64,204 KB
testcase_41 AC 48 ms
64,336 KB
testcase_42 AC 53 ms
66,388 KB
testcase_43 AC 39 ms
55,472 KB
testcase_44 AC 47 ms
64,204 KB
testcase_45 AC 75 ms
72,588 KB
testcase_46 AC 68 ms
70,540 KB
testcase_47 AC 40 ms
55,472 KB
testcase_48 AC 56 ms
66,464 KB
testcase_49 AC 62 ms
68,492 KB
testcase_50 AC 40 ms
55,472 KB
testcase_51 AC 58 ms
68,512 KB
testcase_52 AC 57 ms
66,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

N,M = lmin()
L = [lmin() for _ in range(N)]

dp = [[0]*(1<<N) for _ in range(M+1)]
for i in range(1<<N):
    for j in range(N):
        if i&(1<<j):
            dp[0][i] += 1/L[j][1]
        else:
            dp[0][i] += 1/L[j][0]

for i in range(M):
    for j in range((1<<N)-1,-1,-1):
        dp[i+1][j] = dp[i][j]
        for k in range(N):
            if not j&(1<<k):
                P = L[k][2]
                if P != 1:
                    dp[i+1][j] = max(dp[i+1][j], 1/P*dp[i+1][j|(1<<k)]+(P-1)/P*dp[i][j])
                else:
                    dp[i+1][j] = max(dp[i+1][j], dp[i+1][j|(1<<k)])

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