結果
| 問題 | No.2267 群の公理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-14 21:38:49 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,139 bytes |
| 記録 | |
| コンパイル時間 | 1,225 ms |
| コンパイル使用メモリ | 210,816 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-30 07:23:49 |
| 合計ジャッジ時間 | 2,607 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N,T[30][30];
bool check(){
for(int a = 0;a < N;++a){
for(int b = 0;b < N;++b){
for(int c = 0;c < N;++c){
int ret1 = T[ T[a][b] ][c];
int ret2 = T[a][ T[b][c] ];
if(ret1 != ret2) return false;
}
}
}
bool found = false;
for(int e = 0;e < N;++e){
found = true;
for(int i = 0;i < N;++i){
if(T[i][e] != i || T[e][i] != i){
found = false;
}
}
if(!found) continue;
for(int i = 0;i < N;++i){
found = false;
for(int j = 0;j < N;++j){
if(T[i][j] == e && T[j][i] == e){
found = true;
}
}
if(!found) break;
}
if(found){
return true;
}
}
return false;
}
int main(){
cin >> N;
for(int i = 0;i < N;++i){
for(int j = 0;j < N;++j){
cin >> T[i][j];
}
}
cout << (check()? "Yes" : "No") << endl;
return 0;
}