結果

問題 No.66 輝け☆全国たこやき杯
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-01 21:28:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-04-18 21:37:35
合計ジャッジ時間 1,598 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,584 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 35 ms
52,224 KB
testcase_03 AC 42 ms
52,480 KB
testcase_04 AC 52 ms
62,336 KB
testcase_05 AC 58 ms
64,768 KB
testcase_06 AC 54 ms
64,512 KB
testcase_07 AC 67 ms
68,096 KB
testcase_08 AC 85 ms
71,808 KB
testcase_09 AC 138 ms
76,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = int(input())
S = [int(input()) for i in range(1<<M)]
dp = [[1]*(1<<M) for i in range(M+1)]
for i in range(M):
    for a in range(1<<M):
        win = dp[i][a]
        count = 0
        for b in range(1<<M):
            if a >> i+1 != b >> i+1:
                continue
            if a >> i & 1 == b >> i & 1:
                continue
            count += S[a]**2/(S[a]**2+S[b]**2)*dp[i][b]
        dp[i+1][a] = win*count
print(dp[-1][0])
0