No.3225 2×2 Matrix Similarity Testing ~easy~
タグ : / 解いたユーザー数 45
作問者 :
ジュ・ビオレ・グレイス
/ テスター :
👑 Problem Statement
Let $p$ be the prime $67$. For integers $a, b$, if $a-b$ is divisible by $p$, we say that "$a, b$ are congruent" and write $a \equiv b$. For matrices $A = (A_{i,j}), \, B = (B_{i, j})$, we write $A \equiv B$ if the entries $A_{i, j}, \, B_{i, j}$ are congruent for every position.
You are given $2 \times 2$ matrices $A, B$ with integer entries. Does there exist a $2 \times 2$ matrix $P = \begin{pmatrix}a & b \\ c & d\end{pmatrix}$ with integer entries that satisfies the following two conditions:
- $ad - bc \not\equiv 0$
- $PA \equiv BP$
Yes; otherwise, output No.
Input
$A_{1, 1} \ A_{1, 2}\\
A_{2, 1} \ A_{2, 2}\\
B_{1, 1} \ B_{1, 2}\\
B_{2, 1} \ B_{2, 2}$
$0 \leq A_{i, j}, B_{i, j} < p$ are integers.
$A = \begin{pmatrix}A_{1, 1} \ A_{1, 2} \\ A_{2, 1} \ A_{2, 2}\end{pmatrix}, \ B = \begin{pmatrix}B_{1, 1} \ B_{1, 2} \\ B_{2, 1} \ B_{2, 2}\end{pmatrix}$.
Output
Output Yes or No.
Print a newline at the end.
Sample
Sample 1
Input
3 7 8 10 9 19 35 4
Output
Yes
Taking $P = \begin{pmatrix}3 & 7 \\ 2 & 5\end{pmatrix}$ gives $PA \equiv BP$.
Sample 2
Input
1 0 0 2 2 0 0 4
Output
No
Since the eigenvalues differ, the matrices cannot be similar.
Sample 3
Input
0 1 0 0 0 0 0 0
Output
No
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。