結果
| 問題 |
No.2267 群の公理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-14 21:46:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 1,176 bytes |
| コンパイル時間 | 2,094 ms |
| コンパイル使用メモリ | 197,772 KB |
| 最終ジャッジ日時 | 2025-02-12 06:31:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif
#define REP(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
V<V<int>> A(N, V<int>(N));
REP(i, N) REP(j, N) cin >> A[i][j];
auto op = [&](int a, int b) -> int { return A[a][b]; };
int ok = 1;
REP(n0, N) {
REP(n1, N) {
REP(n2, N) {
if (op(op(n0, n1), n2) != op(n0, op(n1, n2))) {
ok = 0;
}
}
}
}
int exi = 0;
REP(e, N) {
int eok = 1;
REP(n, N) {
if (op(n, e) != n or op(e, n) != n) {
eok = 0;
}
int inv = 0;
REP(i, N) {
if (op(n, i) == e and op(i, n) == e) {
inv = 1;
}
}
if (inv == 0) {
eok = 0;
}
}
if (eok == 1) {
exi = 1;
}
}
cout << (exi and ok ? "Yes" : "No") << '\n';
return 0;
}