問題一覧 > 通常問題

No.3225 2×2 Matrix Similarity Testing ~easy~

レベル : / AI推定難易度 : 600 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 45
作問者 : ジュ・ビオレ・グレイス / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 12505 / 自分の提出
問題文最終更新日: 2025-08-08 23:38:51
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 477 線形代数コンテスト (順位表) の他の問題:

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$
If such a matrix exists, output 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もしくは右上の雲マークをクリックしてアカウントを作成してください。