結果
| 問題 |
No.2267 群の公理
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2023-04-14 22:27:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,094 bytes |
| コンパイル時間 | 1,807 ms |
| コンパイル使用メモリ | 197,776 KB |
| 最終ジャッジ日時 | 2025-02-12 07:13:00 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 46 WA * 4 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
if(n==0){
cout<<"Yes"<<endl;
return 0;
}
vector<vector<int>> A(n,vector<int>(n));
rep(i,n) rep(j,n) cin>>A[i][j];
bool b=true;
for(int x=0;x<n;x++){
for(int y=0;y<n;y++){
for(int z=0;z<n;z++){
if(A[A[x][y]][z]!=A[x][A[y][z]]) b=false;
}
}
}
int e=-1;
for(int x=0;x<n;x++){
bool f=true;
for(int y=0;y<n;y++){
if(A[y][x]!=y || A[x][y]!=y || A[x][y]!=A[y][x]) f=false;
}
if(f){
e=x;
break;
}
}
if(e==-1){
cout<<"No"<<endl;
return 0;
}
bool ans=true;
for(int x=0;x<n;x++){
for(int i=0;i<n;i++){
bool f=true;
for(int y=0;y<n;y++){
if(A[x][i]!=e || A[i][x]!=e) f=false;
}
if(f) break;
else if(i==n-1) ans=false;
}
}
if(ans) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}
umezo