結果

問題 No.2389 Cheating Code Golf
ユーザー 👑 獅子座じゃない人獅子座じゃない人
提出日時 2023-06-18 18:12:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 79,512 KB
最終ジャッジ日時 2023-09-08 14:25:24
合計ジャッジ時間 7,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,136 KB
testcase_01 AC 72 ms
71,320 KB
testcase_02 AC 127 ms
78,512 KB
testcase_03 AC 201 ms
79,512 KB
testcase_04 AC 202 ms
79,428 KB
testcase_05 AC 102 ms
77,476 KB
testcase_06 AC 73 ms
71,384 KB
testcase_07 AC 112 ms
77,360 KB
testcase_08 AC 148 ms
78,276 KB
testcase_09 AC 72 ms
71,184 KB
testcase_10 AC 85 ms
76,724 KB
testcase_11 AC 104 ms
77,412 KB
testcase_12 AC 72 ms
71,340 KB
testcase_13 AC 128 ms
78,212 KB
testcase_14 AC 122 ms
77,796 KB
testcase_15 AC 84 ms
76,540 KB
testcase_16 AC 134 ms
78,240 KB
testcase_17 AC 76 ms
71,460 KB
testcase_18 AC 122 ms
77,504 KB
testcase_19 AC 75 ms
71,292 KB
testcase_20 AC 82 ms
76,520 KB
testcase_21 AC 105 ms
77,432 KB
testcase_22 AC 88 ms
76,880 KB
testcase_23 AC 70 ms
71,388 KB
testcase_24 AC 109 ms
77,400 KB
testcase_25 AC 108 ms
77,632 KB
testcase_26 AC 90 ms
76,908 KB
testcase_27 AC 121 ms
78,284 KB
testcase_28 AC 119 ms
77,892 KB
testcase_29 AC 96 ms
77,344 KB
testcase_30 AC 124 ms
77,856 KB
testcase_31 AC 103 ms
77,380 KB
testcase_32 AC 77 ms
71,620 KB
testcase_33 AC 72 ms
71,528 KB
testcase_34 AC 124 ms
78,292 KB
testcase_35 AC 101 ms
77,396 KB
testcase_36 AC 120 ms
77,788 KB
testcase_37 AC 91 ms
76,876 KB
testcase_38 AC 147 ms
78,696 KB
testcase_39 AC 70 ms
71,424 KB
testcase_40 AC 83 ms
76,568 KB
testcase_41 AC 85 ms
76,736 KB
testcase_42 AC 98 ms
76,812 KB
testcase_43 AC 74 ms
71,460 KB
testcase_44 AC 85 ms
76,740 KB
testcase_45 AC 140 ms
78,432 KB
testcase_46 AC 128 ms
78,252 KB
testcase_47 AC 71 ms
71,504 KB
testcase_48 AC 103 ms
77,416 KB
testcase_49 AC 112 ms
77,848 KB
testcase_50 AC 72 ms
71,632 KB
testcase_51 AC 103 ms
77,680 KB
testcase_52 AC 103 ms
77,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split()) 
abp=[map(int,input().split()) for _ in range(n)]
a,b,p=[list(i) for i in zip(*abp)]

dp=[[0 for j in range(m+1)] for i in range(2**n)]
for i in range(2**n):
    for j in range(m+1):
        for k in range(n):
            if (i>>k)%2:
                if dp[i-2**k][j]+1/a[k]>dp[i][j]:
                    dp[i][j]=dp[i-2**k][j]+1/a[k]
            if j:
                if (i>>k)%2:
                    if (dp[i-2**k][j]+1/b[k])/p[k]+dp[i][j-1]*(1-1/p[k])>dp[i][j]:
                        dp[i][j]=(dp[i-2**k][j]+1/b[k])/p[k]+dp[i][j-1]*(1-1/p[k])
print(dp[2**n-1][m])
0