結果
問題 | No.330 Eigenvalue Decomposition |
ユーザー |
![]() |
提出日時 | 2018-10-14 16:09:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 396 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 200,468 KB |
最終ジャッジ日時 | 2024-10-12 18:18:21 |
合計ジャッジ時間 | 11,028 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 5 |
other | WA * 1 RE * 1 TLE * 1 -- * 28 |
ソースコード
import numpy as np import numpy.linalg as LA N, M = map(int, input().split()) A = np.zeros((N, N), dtype=int) for i in range(0, M): a, b, c = map(int, input().split()) A[a - 1][b - 1] = c A[b - 1][a - 1] = c for i in range(0, N): A[i][i] = -sum(A[i]) eigenvalues, _ = LA.eig(A) ans = 0 for eigenvalues in eigenvalues: if abs(eigenvalues) < 1e-9: ans += 1 print(ans)