結果
| 問題 | No.2267 群の公理 |
| ユーザー |
|
| 提出日時 | 2023-04-14 21:28:02 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 2,000 ms |
| + 56µs | |
| コード長 | 820 bytes |
| 記録 | |
| コンパイル時間 | 1,298 ms |
| コンパイル使用メモリ | 217,148 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-10-29 17:09:59 |
| 合計ジャッジ時間 | 4,168 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 |
ソースコード
#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";
}