結果

問題 No.66 輝け☆全国たこやき杯
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-21 17:17:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 515 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 88,448 KB
最終ジャッジ日時 2023-10-21 11:44:14
合計ジャッジ時間 1,605 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,316 KB
testcase_01 AC 39 ms
53,316 KB
testcase_02 AC 39 ms
53,316 KB
testcase_03 AC 39 ms
53,316 KB
testcase_04 AC 41 ms
53,316 KB
testcase_05 AC 94 ms
62,268 KB
testcase_06 AC 51 ms
64,344 KB
testcase_07 AC 54 ms
68,440 KB
testcase_08 AC 68 ms
76,860 KB
testcase_09 AC 110 ms
88,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def win(si, sj):
    return si * si / (si * si + sj * sj)


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

dp = [1] * N
op = [[i] for i in range(N)]
for i in range(M):
    dp_nxt = [0] * N
    for x in range(N):
        P = 0.
        opponent = op[x].copy()
        for y in opponent:
            y ^= (1 << i)
            P += win(S[x], S[y]) * dp[y]
            op[x].append(y)
        dp_nxt[x] = dp[x] * P
    dp = dp_nxt

print("{:.9f}".format(dp[0]))
0