結果
| 問題 |
No.2267 群の公理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-14 21:28:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 820 bytes |
| コンパイル時間 | 1,975 ms |
| コンパイル使用メモリ | 197,748 KB |
| 最終ジャッジ日時 | 2025-02-12 06:18:46 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<vector<int>>A(N,vector<int>(N));
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
cin>>A[i][j];
}
}
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
for(int k=0;k<N;k++){
if(A[A[i][j]][k]!=A[i][A[j][k]]){
cout<<"No\n";
return 0;
}
}
}
}
for(int e=0;e<N;e++){
bool ok=true;
for(int i=0;i<N;i++){
if(A[e][i]!=i||A[i][e]!=i){
ok=false;
}
bool ng=true;
for(int j=0;j<N;j++){
if(A[i][j]==e&&A[j][i]==e){
ng=false;
}
}
if(ng)ok=false;
}
if(ok){
cout<<"Yes\n";
return 0;
}
}
cout<<"No\n";
}