結果
| 問題 |
No.3225 2×2行列相似判定 〜easy〜
|
| コンテスト | |
| ユーザー |
Cafe1942
|
| 提出日時 | 2025-08-08 21:39:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,736 bytes |
| コンパイル時間 | 965 ms |
| コンパイル使用メモリ | 118,400 KB |
| 実行使用メモリ | 19,016 KB |
| 最終ジャッジ日時 | 2025-08-08 21:39:57 |
| 合計ジャッジ時間 | 7,400 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 -- * 2 |
| other | -- * 33 |
ソースコード
#include <iostream>
#include <iomanip>//小数点出力用
//cout << fixed << setprecision(10) << ans;
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
using ll = long long;
using namespace std;
#define modPHash (ll)((1LL<<61)-1)
#define modP (ll)998244353
bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); }
int clk4(int num) { return (num - 2) * (num % 2); }
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
vector<vector<ll>> mul(vector<vector<ll>>& A, vector<vector<ll>>& B, int size) {
vector<vector<ll>>res;
for (int i = 0; i < size; i++) {
vector<ll>row;
for (int j = 0; j < size; j++) {
ll tmp = 0;
for (int k = 0; k < size; k++) {
tmp += A[i][k] * B[k][j];
}
row.push_back(tmp);
}
res.push_back(row);
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<ll>I(2);
vector<vector<ll>>A(2, I), B(2, I);
for (int i = 0;i < 2;i++) {
for (int j = 0;j < 2;j++) {
cin >> A[i][j];
}
}
for (int i = 0;i < 2;i++) {
for (int j = 0;j < 2;j++) {
cin >> B[i][j];
}
}
vector<vector<ll>>P(2, I);
for (int i = 0;i < 67;i++) {
for (int j = 0;j < 67;j++) {
for (int k = 0;k < 67;k++) {
for (int l = 0;l < 67;l++) {
if (i * l == j * k)continue;
P[0][0] = i;
P[0][1] = j;
P[1][0] = k;
P[1][1] = l;
auto X = mul(P, A, 2);
auto Y = mul(P, B, 2);
bool ok = 1;
for (int a = 0;a < 2;a++) {
for (int b = 0;b < 2;b++) {
if (X[a][b] % 67 != Y[a][b] % 67) {
ok = 0;
}
}
}
if (ok) {
yn(1);
return 0;
}
}
}
}
}
yn(0);
return 0;
}
Cafe1942