/* 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") */ #include #include using namespace std; vector> dot(const vector>& A, const vector>& B) { vector> C(2, vector(2)); for (int row = 0; row < 2; ++row) { for (int col = 0; col < 2; ++col) { int tmp = 0; for (int i = 0; i < 2; ++i) { tmp += A[row][i] * B[i][col]; } C[row][col] = tmp; } } return C; } int main() { vector> A(2, vector(2)); vector> B(2, vector(2)); for (int row = 0; row < 2; ++row) { for (int col = 0; col < 2; ++col) { cin >> A[row][col]; } } for (int row = 0; row < 2; ++row) { for (int col = 0; col < 2; ++col) { cin >> B[row][col]; } } for (int a = 0; a < 67; ++a) { for (int b = 0; b < 67; ++b) { for (int c = 0; c < 67; ++c) { for (int d = 0; d < 67; ++d) { vector> P = {{a, b}, {c, d}}; vector> PA = dot(P, A); vector> BP = dot(B, P); if ((PA[0][0] % 67 == BP[0][0] % 67) && (PA[0][1] % 67 == BP[0][1] % 67) && (PA[1][0] % 67 == BP[1][0] % 67) && (PA[1][1] % 67 == BP[1][1] % 67)) { if ((a * d - b * c) % 67 != 0) { cout << "Yes" << endl; return 0; } } } } } } cout << "No" << endl; return 0; }