結果

問題 No.1151 チャレンジゲーム
ユーザー 37zigen37zigen
提出日時 2020-08-08 18:13:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 50,996 KB
最終ジャッジ日時 2024-04-09 21:42:24
合計ジャッジ時間 12,281 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 475 ms
50,996 KB
testcase_01 AC 463 ms
43,652 KB
testcase_02 WA -
testcase_03 AC 477 ms
43,540 KB
testcase_04 AC 473 ms
43,796 KB
testcase_05 AC 475 ms
43,672 KB
testcase_06 AC 484 ms
43,512 KB
testcase_07 AC 476 ms
43,672 KB
testcase_08 AC 486 ms
43,532 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
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]
            vec=np.array([[-f(b,na,t*(-1))/p+1],[-f(a,nb,t)/q+1]])
            mat=np.array([[1,-(1-1/q)],[-(1-1/p),1]])
            det=(p+q-1)/(p*q)
            mat/=det
            e=min(e,np.dot(mat,vec)[0][0])
        ret=max(ret,e)
    dp[c]=ret
    return ret
print(f(0,0,-1))
0