結果

問題 No.2389 Cheating Code Golf
ユーザー 👑 獅子座じゃない人獅子座じゃない人
提出日時 2023-06-18 18:06:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,783 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 15,344 KB
最終ジャッジ日時 2023-10-10 01:24:04
合計ジャッジ時間 12,119 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,768 KB
testcase_02 AC 366 ms
9,840 KB
testcase_03 AC 1,698 ms
15,344 KB
testcase_04 AC 1,783 ms
15,268 KB
testcase_05 AC 49 ms
8,300 KB
testcase_06 AC 16 ms
7,900 KB
testcase_07 AC 73 ms
8,440 KB
testcase_08 AC 568 ms
10,432 KB
testcase_09 AC 16 ms
7,724 KB
testcase_10 AC 18 ms
7,808 KB
testcase_11 AC 79 ms
8,448 KB
testcase_12 AC 15 ms
7,860 KB
testcase_13 AC 375 ms
9,940 KB
testcase_14 AC 130 ms
8,804 KB
testcase_15 AC 18 ms
7,836 KB
testcase_16 AC 424 ms
9,896 KB
testcase_17 AC 16 ms
7,852 KB
testcase_18 AC 88 ms
8,552 KB
testcase_19 AC 16 ms
7,864 KB
testcase_20 AC 18 ms
7,724 KB
testcase_21 AC 46 ms
8,276 KB
testcase_22 AC 19 ms
7,840 KB
testcase_23 AC 15 ms
7,836 KB
testcase_24 AC 64 ms
8,552 KB
testcase_25 AC 49 ms
8,332 KB
testcase_26 AC 20 ms
7,804 KB
testcase_27 AC 126 ms
9,044 KB
testcase_28 AC 66 ms
8,184 KB
testcase_29 AC 22 ms
8,212 KB
testcase_30 AC 326 ms
9,668 KB
testcase_31 AC 31 ms
8,336 KB
testcase_32 AC 15 ms
7,856 KB
testcase_33 AC 16 ms
7,948 KB
testcase_34 AC 165 ms
9,024 KB
testcase_35 AC 41 ms
8,360 KB
testcase_36 AC 320 ms
9,656 KB
testcase_37 AC 22 ms
8,200 KB
testcase_38 AC 702 ms
11,276 KB
testcase_39 AC 16 ms
7,780 KB
testcase_40 AC 17 ms
7,880 KB
testcase_41 AC 19 ms
8,280 KB
testcase_42 AC 23 ms
8,176 KB
testcase_43 AC 16 ms
7,720 KB
testcase_44 AC 17 ms
7,804 KB
testcase_45 AC 633 ms
10,932 KB
testcase_46 AC 285 ms
9,704 KB
testcase_47 AC 15 ms
7,880 KB
testcase_48 AC 62 ms
8,240 KB
testcase_49 AC 118 ms
8,744 KB
testcase_50 AC 15 ms
7,836 KB
testcase_51 AC 73 ms
8,604 KB
testcase_52 AC 43 ms
8,352 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