結果

問題 No.66 輝け☆全国たこやき杯
ユーザー 👑 colognecologne
提出日時 2022-01-25 11:12:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 76,984 KB
最終ジャッジ日時 2023-08-22 03:45:33
合計ジャッジ時間 2,032 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,104 KB
testcase_01 AC 71 ms
71,648 KB
testcase_02 AC 73 ms
71,636 KB
testcase_03 AC 72 ms
71,204 KB
testcase_04 AC 74 ms
71,216 KB
testcase_05 AC 79 ms
75,940 KB
testcase_06 AC 84 ms
76,200 KB
testcase_07 AC 86 ms
76,344 KB
testcase_08 AC 94 ms
76,528 KB
testcase_09 AC 124 ms
76,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    M = int(input())
    S = [int(input()) for i in range(1 << M)]
    prob = [[(i, 1)] for i in range(1 << M)]

    while len(prob) > 1:

        def merge(A, B):
            ret = {}
            for a, x in A:
                for b, y in B:
                    ret[a] = ret.get(a, 0) + x*y * \
                        (S[a]*S[a])/(S[a]*S[a]+S[b]*S[b])
                    ret[b] = ret.get(b, 0) + x*y * \
                        (S[b]*S[b])/(S[a]*S[a]+S[b]*S[b])

            return list(ret.items())

        prob = [merge(prob[i], prob[i+1]) for i in range(0, len(prob), 2)]

    for x, y in prob[0]:
        if x == 0:
            print(y)


if __name__ == '__main__':
    main()
0