题意:n个点m条边,找点集个数,点集满足有任意三个点成环,或者三个点互不相连
题解:暴力复杂度O(n^5/120*O(ok))==O(能过)
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #define fi first #define se second #define mk make_pair #define pb push_back #define pi acos(-1.0) #define ll long long #define vi vector<int> #define mod 1000000007 #define C 0.5772156649 #define ls l,m,rt<<1 #define rs m+1,r,rt<<1|1 #define pil pair<int,ll> #define pli pair<ll,int> #define pii pair<int,int> #define cd complex<double> #define ull unsigned long long #define base 1000000000000000000 #define fio ios::sync_with_stdio(false);cin.tie(0) using namespace std; const double g=10.0,eps=1e-12; const int N=50+10,maxn=60000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f; int ma[N][N]; ll c[N][N]; void init() { c[1][0]=c[1][1]=1; for(int i=2;i<N;i++) { for(int j=0;j<=i;j++) { if(j==0)c[i][j]=1; else c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod; } } } ll quick(ll a,ll b) { ll ans=1; while(b) { if(b&1)ans=ans*a%mod; a=a*a%mod; b>>=1; } return ans; } bool ok(int a,int b,int c) { if(ma[a][b]&&ma[b][c]&&ma[c][a])return 1; if(!ma[a][b]&&!ma[b][c]&&!ma[c][a])return 1; return 0; } bool ok(int a,int b,int c,int d) { if(ok(a, b, c))return 1; if(ok(a, b, d)) return 1; if(ok(a, c, d))return 1; if(ok(b, c, d))return 1; return 0; } bool ok(int a,int b,int c,int d,int e) { if(ok(a,b,c,d))return 1; if(ok(a,b,c,e))return 1; if(ok(a,b,e,d))return 1; if(ok(a,e,c,d))return 1; if(ok(e,b,c,d))return 1; return 0; } int main() { init(); int T;scanf("%d",&T); for(int _=1;_<=T;_++) { memset(ma,0,sizeof ma); int n,m; scanf("%d%d",&n,&m); for(int i=0;i<m;i++) { int a,b;scanf("%d%d",&a,&b); ma[a][b]=ma[b][a]=1; } ll ans=0; if(n>=6) { ans=quick(2,n); for(int i=0;i<=5;i++) { ans-=c[n][i]; ans=(ans+mod)%mod; } } for(int i=1;i<=n;i++) for(int j=1+i;j<=n;j++) for(int k=1+j;k<=n;k++) if(ok(i,j,k)) ans++; for(int i=1;i<=n;i++) for(int j=1+i;j<=n;j++) for(int k=1+j;k<=n;k++) for(int u=1+k;u<=n;u++) if(ok(i,j,k,u)) ans++; for(int i=1;i<=n;i++) for(int j=1+i;j<=n;j++) for(int k=1+j;k<=n;k++) for(int u=1+k;u<=n;u++) for(int v=1+u;v<=n;v++) if(ok(i,j,k,u,v)) ans++; printf("Case #%d: %lld ",_,ans%mod); } return 0; } /*********************** ***********************/