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

42 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int n;
/*
4
1 2
1 3
1 4
1 5
*/
struct Node {
int x, y;
} b[N]; // 表示区域x和区域y之间存在公共边
bool check(int i, int j, int k, int p, int q) {
vector<int> color = {0, i, j, k, p, q};
for (int x = 1; x <= n; x++) {
if (color[b[x].x] == color[b[x].y]) return false;
}
return true;
}
int ans;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> b[i].x >> b[i].y;
// 5个区域,4个颜色,构建每一组组合,不管是否合理都列出来
for (int i = 1; i <= 4; i++)
for (int j = 1; j <= 4; j++)
for (int k = 1; k <= 4; k++)
for (int p = 1; p <= 4; p++)
for (int q = 1; q <= 4; q++) {
// 此时的i,j,k,p,q表示5个区域的颜色
// 判断是不是合理
if (check(i, j, k, p, q))
ans++;
}
cout << ans << endl;
return 0;
}