結果
| 問題 |
No.2267 群の公理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-14 21:48:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,194 bytes |
| コンパイル時間 | 3,038 ms |
| コンパイル使用メモリ | 160,564 KB |
| 最終ジャッジ日時 | 2025-02-12 06:33:34 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 49 WA * 1 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cstring>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)
int main(){
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];
}
}
bool yes = true;
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]]){
yes = false;
break;
}
}
}
}
int cnt = 0;
int ee = 0;
for (int i = 0; i < n;i++){
for (int e = 0; e < n;e++){
if (a[i][e] == i && a[e][i] == i){
cnt++;
ee = e;
}
}
}
if (cnt != n){
yes = false;
}
cnt = 0;
for (int i = 0; i < n;i++){
for (int j = 0; j < n;j++){
if (a[i][j] == ee && ee == a[j][i]){
cnt++;
}
}
}
if (cnt != n){
yes = false;
}
if (yes) cout << "Yes\n";
else cout << "No\n";
return 0;
}