結果

問題 No.66 輝け☆全国たこやき杯
ユーザー titiatitia
提出日時 2022-01-07 00:25:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 737 ms / 5,000 ms
コード長 784 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-25 10:12:36
合計ジャッジ時間 1,909 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 26 ms
10,880 KB
testcase_05 AC 29 ms
10,880 KB
testcase_06 AC 38 ms
10,880 KB
testcase_07 AC 69 ms
10,880 KB
testcase_08 AC 200 ms
11,008 KB
testcase_09 AC 737 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=int(input())
S=[int(input()) for i in range(1<<M)]

DP=[]
for i in range(1<<M):
    DP.append({i:1})

for tests in range(M):
    #print(DP)
    NDP=[]
    for i in range(0,len(DP),2):
        a=DP[i]
        b=DP[i+1]

        D=dict()

        for x in a:
            for y in b:
                k=S[x]
                l=S[y]

                Pk=k*k/(k*k+l*l)
                Pl=l*l/(k*k+l*l)

                if x in D:
                    D[x]+=a[x]*b[y]*Pk
                else:
                    D[x]=a[x]*b[y]*Pk

                if y in D:
                    D[y]+=a[x]*b[y]*Pl
                else:
                    D[y]=a[x]*b[y]*Pl
        NDP.append(D)

    #print(NDP)

    DP=NDP
                    
print(DP[0][0])                   
                
    
    
0