Meaning of the questions: give you n points m edges ask largest independent set of all sub-graph and you
Ideas: we can set f state is the size of the current largest independent set in a set of points so we can put the set into two parts it contains this absolutely is absolutely a point that does not contain this point over and over again and then a maximum of two cases
Because of the open space is tight we have to use an array of char
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int N = 1e5+7; const int inf = 0x3f3f3f3f; const double eps = 1e-6; typedef long long ll; const ll mod = 1e7+9; int e[27]; char f[1<<26]; char max(char a,char b){ if(a>b) return a; else return b; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ int a,b; cin>>a>>b; e[a]=(e[a]|(1<<b)); e[b]=(e[b]|(1<<a)); } for(int i=0;i<n;i++){ e[i]=(e[i]|(1<<i)); e[i]=(~e[i]); } ll ans=0; f[0]=0; for(int i=1;i<(1<<n);i++){ int po; for(int j=0;j<26;j++) if((i>>j)&1){ po=j; break; } f[i]=max(f[i^(1<<po)],f[(i&e[po])]+1); ans+=f[i]; } cout<<ans<<endl; }