#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e6 + 5;
const ll MOD = 998244353;
int n, m, g[MAXN];
bool works[MAXN];
ll dp[MAXN];
void solve() {
cin >> n >> m;
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
x--, y--;
g[x] |= (1 << y), g[y] |= (1 << x);
}
for (int i = 0; i < (1 << n); i++) {
works[i] = 1;
for (int j = 1; j <= n; j++) {
if (i >> j & 1) works[i] &= ((g[j] & i) == 0);
}
}
dp[0] = 1;
for (int i = 1; i < (1 << n); i++) {
for (int j = i; j; j = (j - 1) & i) {
if (!works[j]) continue;
dp[i] += (__builtin_popcount(j) & 1 ? 1 : -1) * dp[i ^ j];
(dp[i] += MOD) %= MOD;
}
}
cout << dp[(1 << n) - 1] * m % MOD * (MOD + 1 >> 1) % MOD << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |