結果

問題 No.2447 行列累乗根
ユーザー 👑 hitonanodehitonanode
提出日時 2023-08-25 23:12:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 973 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 51,936 KB
最終ジャッジ日時 2023-08-25 23:12:58
合計ジャッジ時間 18,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
30,292 KB
testcase_01 AC 115 ms
30,276 KB
testcase_02 AC 118 ms
30,092 KB
testcase_03 AC 115 ms
30,080 KB
testcase_04 AC 127 ms
30,088 KB
testcase_05 AC 117 ms
30,092 KB
testcase_06 AC 118 ms
30,116 KB
testcase_07 AC 120 ms
30,088 KB
testcase_08 AC 120 ms
30,220 KB
testcase_09 AC 117 ms
30,180 KB
testcase_10 AC 118 ms
29,964 KB
testcase_11 AC 113 ms
30,172 KB
testcase_12 AC 130 ms
30,192 KB
testcase_13 AC 118 ms
30,084 KB
testcase_14 AC 119 ms
29,968 KB
testcase_15 AC 116 ms
29,968 KB
testcase_16 AC 110 ms
30,284 KB
testcase_17 AC 117 ms
29,976 KB
testcase_18 AC 140 ms
30,192 KB
testcase_19 AC 381 ms
32,168 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
import numpy as np

input = stdin.readline

def cb(a):
    if a >= 0:
        return pow(a, 1 / 3)
    else:
        return -pow(-a, 1 / 3)

T = int(input())

ret: list[str] = []

for _ in range(T):
    a, b = map(float, input().split())
    c, d = map(float, input().split())
    A = np.array([[a, b], [c, d]])

    eigval, eigvec = np.linalg.eigh(A)
    M = np.array([[eigvec[0][0], eigvec[0][1]], [eigvec[1][0], eigvec[1][1]]])

    e0 = cb(eigval[0])
    e1 = cb(eigval[1])

    m0 = eigvec[0][0]
    m1 = eigvec[0][1]
    m2 = eigvec[1][0]
    m3 = eigvec[1][1]

    # B = M @ np.diag([e0, e1]) @ M.T
    # ret.append("{:1.5f} {:1.5f}".format(B[0][0], B[0][1]))
    # ret.append("{:1.5f} {:1.5f}".format(B[1][0], B[1][1]))

    ret.append("{:1.5f} {:1.5f}".format(m0 * m0 * e0 + m1 * m1 * e1, m0 * m2 * e0 + m1 * m3 * e1))
    ret.append("{:1.5f} {:1.5f}".format(m2 * m0 * e0 + m3 * m1 * e1, m2 * m2 * e0 + m3 * m3 * e1))


print(*ret, sep="\n")
0