https://codeforces.com/problemset/problem/1210/A
思路:n只有7,暴搜。
想着建图暴搜,但是会导致不连通有点不好处理。
于是对所有点直接全排列点数(7!),然后满了之后就check一次就好
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=8;
typedef int LL;
inline LL read(){LL x=0,f=1;char ch=getchar(); while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
vector<pair<LL,LL>>g;
LL p[maxn][maxn];
LL face[maxn];
LL ans=0;
LL res=0;
void update(LL n){
memset(p,0,sizeof(p));
for(LL i=0;i<g.size();i++){
LL u=face[g[i].first];
LL v=face[g[i].second];
if(u>v) swap(u,v);
if(!p[u][v]){
p[u][v]=1;
res++;
}
}
ans=max(ans,res);
}
void dfs(LL u,LL n){
if(u==n+1){
res=0;
update(n);
return;
}
for(LL i=1;i<=6;i++){
face[u]=i;
dfs(u+1,n);
}
}
int main(void)
{
cin.tie(0);std::ios::sync_with_stdio(false);
LL n,m;cin>>n>>m;
for(LL i=1;i<=m;i++){
LL u,v;cin>>u>>v;
g.push_back({min(u,v),max(u,v)});
}
dfs(1,n);
cout<<ans<<"\n";
return 0;
}