結果

問題 No.1151 チャレンジゲーム
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-08-16 22:20:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 81,308 KB
最終ジャッジ日時 2024-04-19 18:34:31
合計ジャッジ時間 8,424 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,840 KB
testcase_01 AC 35 ms
51,968 KB
testcase_02 AC 46 ms
62,848 KB
testcase_03 AC 34 ms
52,224 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 33 ms
51,840 KB
testcase_06 AC 34 ms
52,480 KB
testcase_07 AC 33 ms
51,584 KB
testcase_08 AC 34 ms
52,480 KB
testcase_09 AC 32 ms
52,096 KB
testcase_10 AC 33 ms
52,480 KB
testcase_11 AC 39 ms
60,544 KB
testcase_12 AC 46 ms
61,952 KB
testcase_13 AC 148 ms
78,080 KB
testcase_14 AC 125 ms
77,312 KB
testcase_15 AC 121 ms
77,312 KB
testcase_16 AC 149 ms
78,072 KB
testcase_17 AC 149 ms
78,080 KB
testcase_18 AC 120 ms
77,192 KB
testcase_19 AC 131 ms
77,440 KB
testcase_20 AC 114 ms
77,440 KB
testcase_21 AC 132 ms
77,824 KB
testcase_22 AC 100 ms
76,928 KB
testcase_23 AC 118 ms
77,080 KB
testcase_24 AC 128 ms
77,176 KB
testcase_25 AC 142 ms
77,696 KB
testcase_26 AC 144 ms
78,080 KB
testcase_27 AC 134 ms
77,312 KB
testcase_28 AC 182 ms
78,976 KB
testcase_29 AC 195 ms
80,388 KB
testcase_30 AC 158 ms
78,944 KB
testcase_31 AC 185 ms
80,404 KB
testcase_32 AC 161 ms
79,060 KB
testcase_33 AC 180 ms
80,836 KB
testcase_34 AC 179 ms
79,584 KB
testcase_35 AC 170 ms
79,744 KB
testcase_36 AC 216 ms
81,308 KB
testcase_37 AC 202 ms
80,000 KB
testcase_38 AC 178 ms
79,744 KB
testcase_39 AC 162 ms
78,976 KB
testcase_40 AC 176 ms
79,104 KB
testcase_41 AC 157 ms
78,752 KB
testcase_42 AC 196 ms
81,108 KB
testcase_43 AC 190 ms
80,384 KB
testcase_44 AC 175 ms
79,140 KB
testcase_45 AC 182 ms
79,460 KB
testcase_46 AC 194 ms
81,024 KB
testcase_47 AC 159 ms
79,036 KB
testcase_48 AC 135 ms
77,184 KB
testcase_49 AC 116 ms
76,928 KB
testcase_50 AC 169 ms
78,492 KB
testcase_51 AC 170 ms
79,232 KB
testcase_52 AC 212 ms
80,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))

count = [0]*(1<<n)
for i in range(1<<n):
    for j in range(n):
        if i>>j & 1:
            count[i] += a[j]

d = {}

def cal(s,t):
    if t <= 0:
        return 1
    if s == 0:
        return 0
    sta = s+ (t<<n)
    h = count[s]
    if sta in d:
        return d[sta]
    now = 0
    for i in range(n):
        if not s>>i & 1:
            continue
        nf = s^(1<<i)
        sco = 1
        for j in range(n):
            if not s>>j & 1:
                continue
            ns = s^(1<<j)
            p,q = 1/a[i],1/a[j]
            x,y = 1-cal(nf,h+1-t),cal(ns,t)
            v = (p*x+(1-p)*q*y)/(p+q-p*q)
            sco = min(sco,v)
        now = max(sco,now)
    d[sta] = now
    return now
print(cal((1<<n)-1,sum(a)//2+1))
0