結果

問題 No.66 輝け☆全国たこやき杯
ユーザー rlangevinrlangevin
提出日時 2023-09-14 12:28:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 77,036 KB
最終ジャッジ日時 2023-09-14 12:28:47
合計ジャッジ時間 2,326 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,580 KB
testcase_01 AC 74 ms
71,416 KB
testcase_02 AC 76 ms
71,340 KB
testcase_03 AC 76 ms
71,556 KB
testcase_04 AC 84 ms
76,512 KB
testcase_05 AC 89 ms
77,036 KB
testcase_06 AC 88 ms
76,628 KB
testcase_07 AC 98 ms
76,844 KB
testcase_08 AC 113 ms
76,876 KB
testcase_09 AC 163 ms
76,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

M = int(input())
M2 = 1 << M
S = [0] * M2
for i in range(M2):
    S[i] = int(input())

pre = [1] * M2
for i in range(M):
    dp = [0] * M2
    for j in range(M2):
        for k in range(M2):
            if j >> (i + 1) != k >> (i + 1):
                continue
            if (j >> i) & 1 != (k >> i) & 1:
                dp[j] += S[j] ** 2/(S[j] ** 2 + S[k] ** 2) * pre[j] * pre[k]
    dp, pre = pre, dp

print(pre[0])
0