結果

問題 No.3225 2×2行列相似判定 〜easy〜
ユーザー u_kun
提出日時 2025-08-08 21:38:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,086 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 86,288 KB
最終ジャッジ日時 2025-08-08 21:38:12
合計ジャッジ時間 4,068 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1 -- * 1
other -- * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

def dot(A, B):
    
    C = [[None for col in range(2)] for row in range(2)]
    
    for row in range(2):
        for col in range(2):
            
            # C[row][col]:= Aのrow行目とBのcol列目の内積
            tmp = 0
            
            for i in range(2):
                tmp += A[row][i] * B[i][col]
            
            C[row][col] = tmp
    
    return C
    
A = [list(map(int, input().split())) for row in range(2)]
B = [list(map(int, input().split())) for row in range(2)]

for a in range(67):
    for b in range(67):
        for c in range(67):
            for d in range(67):
                
                P = [[a, b], [c, d]]
                
                PA = dot(P, A)
                BP = dot(B, P)
                

                if (PA[0][0]%67 == BP[0][0]%67) and (PA[0][1]%67 == BP[0][1]%67) and (PA[1][0]%67 == BP[1][0]%67) and (PA[1][1]%67 == BP[1][1]%67):
                    if (a*d - b*c) % 67 != 0:
                        print("Yes")
                        exit()
                            
                
print("No")   
0