# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377462 | marat0210 | Geppetto (COCI15_geppetto) | C++14 | 4 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN = 21;
int n, m;
bool uzeo[MAXN];
vector <int> E[MAXN];
int calc (int x) {
if (x == n) return 1;
int ret = calc(x+1);
bool ok = 1;
for (auto v: E[x])
if (uzeo[v]) ok = 0;
if (ok){
uzeo[x] = 1;
ret += calc(x+1);
uzeo[x] = 0;
}
return ret;
}
int main (void){
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) {
int x, y; scanf("%d%d", &x, &y);
--x; --y;
E[x].push_back(y);
E[y].push_back(x);
}
printf("%d\n", calc(0));
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |