Submission #252692

#TimeUsernameProblemLanguageResultExecution timeMemory
252692NONAMEGeppetto (COCI15_geppetto)C++14
80 / 80
450 ms504 KiB
#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 timeMemoryGrader output
Fetching results...