結果

問題 No.1151 チャレンジゲーム
ユーザー 37zigen37zigen
提出日時 2020-08-09 03:57:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 651 ms / 2,000 ms
コード長 724 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,488 KB
実行使用メモリ 92,852 KB
最終ジャッジ日時 2024-04-14 07:48:09
合計ジャッジ時間 22,849 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,068 KB
testcase_01 AC 40 ms
54,352 KB
testcase_02 AC 67 ms
68,612 KB
testcase_03 AC 38 ms
53,436 KB
testcase_04 AC 38 ms
53,096 KB
testcase_05 AC 38 ms
52,892 KB
testcase_06 AC 38 ms
53,212 KB
testcase_07 AC 38 ms
52,200 KB
testcase_08 AC 38 ms
53,384 KB
testcase_09 AC 39 ms
53,220 KB
testcase_10 AC 39 ms
53,872 KB
testcase_11 AC 64 ms
68,836 KB
testcase_12 AC 64 ms
68,976 KB
testcase_13 AC 326 ms
82,360 KB
testcase_14 AC 335 ms
81,856 KB
testcase_15 AC 331 ms
82,160 KB
testcase_16 AC 322 ms
82,116 KB
testcase_17 AC 342 ms
82,008 KB
testcase_18 AC 326 ms
81,752 KB
testcase_19 AC 343 ms
82,084 KB
testcase_20 AC 315 ms
81,640 KB
testcase_21 AC 335 ms
81,900 KB
testcase_22 AC 330 ms
81,884 KB
testcase_23 AC 339 ms
82,012 KB
testcase_24 AC 334 ms
81,912 KB
testcase_25 AC 315 ms
81,872 KB
testcase_26 AC 333 ms
81,864 KB
testcase_27 AC 327 ms
81,904 KB
testcase_28 AC 616 ms
92,260 KB
testcase_29 AC 580 ms
91,588 KB
testcase_30 AC 621 ms
92,192 KB
testcase_31 AC 598 ms
91,760 KB
testcase_32 AC 620 ms
91,800 KB
testcase_33 AC 620 ms
92,168 KB
testcase_34 AC 647 ms
92,356 KB
testcase_35 AC 620 ms
91,928 KB
testcase_36 AC 604 ms
91,664 KB
testcase_37 AC 595 ms
91,388 KB
testcase_38 AC 651 ms
92,624 KB
testcase_39 AC 594 ms
92,052 KB
testcase_40 AC 618 ms
91,852 KB
testcase_41 AC 590 ms
92,852 KB
testcase_42 AC 612 ms
92,132 KB
testcase_43 AC 624 ms
92,504 KB
testcase_44 AC 642 ms
92,496 KB
testcase_45 AC 636 ms
92,176 KB
testcase_46 AC 610 ms
92,196 KB
testcase_47 AC 596 ms
92,092 KB
testcase_48 AC 424 ms
89,960 KB
testcase_49 AC 536 ms
90,692 KB
testcase_50 AC 607 ms
91,900 KB
testcase_51 AC 627 ms
92,276 KB
testcase_52 AC 623 ms
92,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[int(x) for x in input().split()]
s=[0]*(1<<N)
for i in range(1<<N):
    for j in range(N):
        if (i&(1<<j))>0:
            s[i]+=A[j]
dp={}
def f(a,b,t):
    if (a|b)==(1<<N)-1:
        return 1 if 2*s[a]+t>2*s[b] else 0
    c=int((a|(b<<N))*t)
    if c in dp:
        return dp[c]
    ret=0
    for i in range(N):
        na=a|(1<<i)
        if (na|b)==(a|b):
            continue
        e=1
        for j in range(N):
            nb=b|(1<<j)
            if (a|nb)==(a|b):
                continue
            p,q=A[i],A[j]
            v=1/p-f(b,na,t*(-1))/p+f(a,nb,t)/q*(1-1/p)
            v/=(p+q-1)/(p*q)
            e=min(e,v)
        ret=max(ret,e)
    dp[c]=ret
    return ret
print(f(0,0,-1))
0