// In the name of the God
#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
const int inf = 1e9+7;
const int mod = 998244353;
const int maxn = 18;
int n, m, adj[1<<maxn], ind[1<<maxn], dp[1<<maxn];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i = 0; i < m; i++) {
int v, u; cin >> v >> u;
adj[1<<(--v)] |= 1<<(--u);
adj[1<<u] |= 1<<v;
}
ind[0] = 1;
for (int mask = 1; mask < (1<<n); mask++) {
ind[mask] = ind[mask&(mask-1)]&!(adj[mask&(-mask)]&mask);
cout << mask << ' ' << ind[mask] << '\n';
}
dp[0] = 1;
for (int mask = 1; mask < (1<<n); mask++) {
for (int smask = mask; smask; smask = (smask-1)&mask) {
if (ind[smask]) dp[mask] += (__builtin_parity(smask)*2-1)*dp[mask^smask];
}
}
cout << dp[(1<<n)-1]*m/2 << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |