#include <bits/stdc++.h>
using namespace std;
long long n, m, ans;
bool sastojci[25], ok;
pair<int, int> fuj[500];
void pizza(int i){
for (int j=1;j<=n;j++){
sastojci[j] = i%2;
i=i/2;
}
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i=0;i<m;i++){
int a, b;
cin >> a >> b;
fuj[i]=make_pair(a,b);
}
long long x = pow(2.0, (double)n);
for (int i=0;i<x;i++){
ok = true;
pizza(i);
for (int j=0;j<m;j++)if (sastojci[fuj[j].first] and sastojci[fuj[j].second]) {ok=0; break;}
if (ok) ans++;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
42 ms |
384 KB |
Output is correct |
4 |
Correct |
32 ms |
384 KB |
Output is correct |
5 |
Correct |
32 ms |
384 KB |
Output is correct |
6 |
Correct |
39 ms |
384 KB |
Output is correct |
7 |
Correct |
35 ms |
384 KB |
Output is correct |
8 |
Correct |
35 ms |
384 KB |
Output is correct |
9 |
Correct |
31 ms |
384 KB |
Output is correct |
10 |
Correct |
26 ms |
384 KB |
Output is correct |