# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377462 | 2021-03-14T08:49:11 Z | marat0210 | Geppetto (COCI15_geppetto) | C++14 | 4 ms | 364 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |