# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252692 | NONAME | Geppetto (COCI15_geppetto) | C++14 | 450 ms | 504 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 <bits/stdc++.h>
#define dbg(x) cerr << #x << " = " << x << "\n"
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie()
using namespace std;
using ll = long long;
bool mk[30];
int n, m;
vector <int> g[30];
void dfs(int v) {
if (mk[v])
return;
mk[v] = 1;
for (int u : g[v])
dfs(u);
}
int main() {
fast_io;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
--x, --y;
g[x].push_back(y);
g[y].push_back(x);
}
for (int i = 0; i < n; ++i)
sort(g[i].begin(), g[i].end());
int ans = 0;
for (int i = 0; i < (1 << n); ++i) {
vector <int> vec;
for (int j = 0; j < n; ++j)
mk[j] = 0;
for (int j = 0; j < n; ++j)
if (i & (1 << j))
vec.push_back(j), mk[j] = 1;
int f = 1;
for (int x : vec) {
for (int y : g[x])
if (mk[y])
f = 0;
if (!f) break;
}
ans += f;
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |