結果

問題 No.2389 Cheating Code Golf
ユーザー 👑 rin204rin204
提出日時 2024-04-07 15:43:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 78,840 KB
最終ジャッジ日時 2024-04-07 15:44:05
合計ジャッジ時間 5,946 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 87 ms
76,480 KB
testcase_03 AC 136 ms
78,840 KB
testcase_04 AC 138 ms
78,728 KB
testcase_05 AC 60 ms
68,772 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 63 ms
68,752 KB
testcase_08 AC 93 ms
76,628 KB
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 48 ms
62,492 KB
testcase_11 AC 61 ms
68,756 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 90 ms
76,748 KB
testcase_14 AC 68 ms
70,836 KB
testcase_15 AC 48 ms
62,124 KB
testcase_16 AC 87 ms
76,636 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 66 ms
70,836 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 48 ms
62,096 KB
testcase_21 AC 60 ms
68,612 KB
testcase_22 AC 50 ms
64,572 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 66 ms
70,844 KB
testcase_25 AC 63 ms
68,620 KB
testcase_26 AC 51 ms
64,588 KB
testcase_27 AC 74 ms
73,436 KB
testcase_28 AC 71 ms
73,440 KB
testcase_29 AC 54 ms
64,600 KB
testcase_30 AC 75 ms
72,892 KB
testcase_31 AC 58 ms
66,660 KB
testcase_32 AC 37 ms
53,460 KB
testcase_33 AC 38 ms
53,460 KB
testcase_34 AC 73 ms
73,436 KB
testcase_35 AC 59 ms
68,772 KB
testcase_36 AC 73 ms
72,876 KB
testcase_37 AC 54 ms
66,684 KB
testcase_38 AC 100 ms
76,876 KB
testcase_39 AC 36 ms
53,460 KB
testcase_40 AC 47 ms
62,364 KB
testcase_41 AC 48 ms
62,492 KB
testcase_42 AC 56 ms
66,536 KB
testcase_43 AC 37 ms
53,460 KB
testcase_44 AC 47 ms
62,492 KB
testcase_45 AC 91 ms
76,868 KB
testcase_46 AC 81 ms
76,612 KB
testcase_47 AC 37 ms
53,460 KB
testcase_48 AC 61 ms
68,748 KB
testcase_49 AC 66 ms
70,828 KB
testcase_50 AC 36 ms
53,460 KB
testcase_51 AC 61 ms
68,756 KB
testcase_52 AC 61 ms
68,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
m += 1
abp = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * m for _ in range(1 << n)]
for bit in range((1 << n) - 1, -1, -1):
    for j in range(m - 1, -1, -1):
        for i in range(n):
            if bit >> i & 1:
                continue
            a, b, p = abp[i]
            nbit = bit | 1 << i
            dp[bit][j] = max(dp[bit][j], dp[nbit][j] + (1 / a))
            if j != m - 1:
                tmp = (dp[nbit][j] + 1 / b) * (1 / p)
                tmp += dp[bit][j + 1] * (1 - 1 / p)
                dp[bit][j] = max(dp[bit][j], tmp)

print(dp[0][0])
0