#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define PB push_back
using namespace std;
typedef long long ll;
const int N = 22;
bool bad[N][N];
int n, m, ans;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m;
for (int i = 0; i < m; i++){
int x, y; cin >> x >> y;
x--; y--;
bad[x][y] = bad[y][x] = 1;
}
for (int msk = 0; msk < (1 << n); msk++){
bool ok = 1;
for (int i = 0; i < n && ok; i++){
if (!(msk & (1 << i))) continue;
for (int j = i + 1; j < n && ok; j++){
if (!(msk & (1 << j))) continue;
if (bad[i][j])
ok = 0;
}
}
ans += ok;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
9 ms |
384 KB |
Output is correct |
5 |
Correct |
14 ms |
384 KB |
Output is correct |
6 |
Correct |
27 ms |
384 KB |
Output is correct |
7 |
Correct |
33 ms |
384 KB |
Output is correct |
8 |
Correct |
49 ms |
384 KB |
Output is correct |
9 |
Correct |
120 ms |
384 KB |
Output is correct |
10 |
Correct |
231 ms |
504 KB |
Output is correct |