結果
問題 | No.2447 行列累乗根 |
ユーザー |
![]() |
提出日時 | 2023-08-25 22:09:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 735 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 121,324 KB |
最終ジャッジ日時 | 2024-12-24 08:59:59 |
合計ジャッジ時間 | 55,144 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 11 TLE * 10 |
ソースコード
import numpy as npfrom scipy.linalg import fractional_matrix_powerT = int(input())def cb(a):if a >= 0:return pow(a, 1 / 3)else:return -pow(-a, 1 / 3)for _ in range(T):a, b = map(float, input().split())c, d = map(float, input().split())A = np.array([[a, b], [c, d]])B = fractional_matrix_power(A, 1 / 3)eig = np.linalg.eig(A)M = np.array([[eig.eigenvectors[0][0], eig.eigenvectors[1][0]], [eig.eigenvectors[0][1], eig.eigenvectors[1][1]]])e0 = cb(eig.eigenvalues[0])e1 = cb(eig.eigenvalues[1])B = M.T * np.diag([e0, e1]) * Mprint("{:1.5f}".format(B[0][0]), "{:1.5f}".format(B[0][1]))print("{:1.5f}".format(B[1][0]), "{:1.5f}".format(B[1][1]))