Files
python/TangDou/Mkx/TD.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

32 lines
613 B
C++

#include <bits/stdc++.h>
using namespace std;
const int N = 15;
int n, ans, color[N];
struct Node{
int x, y;
} a[N];
void dfs(int u){
if(u>5){
bool flag = true;
for (int i = 1;i<=n;i++){
if(color[a[i].x]==color[a[i].y]){
flag = false;
break;
}
}
if (flag) ans++;
return;
}
for (int i = 1; i <= 4;i++){
color[u]=i;
dfs(u + 1);
}
}
int main() {
cin>>n;
for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y;
dfs(1);
cout<<ans<<endl;
return 0;
}