#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
bool c[n + 1][n + 1] {};
for(int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
c[a][b] = c[b][a] = 1;
}
int cnt = 0;
for(int i = 0; i < (1 << n); i++) {
vector<int> v;
bool ok = 1;
for(int j = 0; j < n; j++) {
if((i >> j) % 2 == 1) v.push_back(j + 1);
}
int sz = v.size();
for(int j = 0; j < sz; j++) {
for(int k = j + 1; k < sz; k++) {
if(c[v[j]][v[k]]) ok = 0;
}
}
cnt += (ok ? 1 : 0);
}
cout << cnt << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |