#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
#define fir first
#define sec second
typedef vector <int> vi;
typedef vector <ll> vl;
template <typename __Tp> void read(__Tp &x) {
int f = 0; x = 0; char ch = getchar();
for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = 1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
if (f) x = -x;
}
template <typename __Tp1, typename ...__Tp2> void read(__Tp1 &x, __Tp2 &...y) { read(x), read(y...); }
template <typename __Tp> void write(__Tp x) {
if (x < 0) putchar('-'), x = -x;
if (x > 9) write(x / 10);
putchar(x % 10 + 48);
}
void write(char ch) { putchar(ch); }
template <typename __Tp1, typename ...__Tp2> void write(__Tp1 x, __Tp2 ...y) { write(x), write(y...); }
const int mod = 998244353;
template <int mod>
struct mint {
#define fix(x) (((x) % mod + mod) % mod)
int x;
mint() { x = 0; }
template <typename __Tp> mint(__Tp _x) { x = fix(_x); }
friend mint operator + (mint a, mint b) { return a.x + b.x; }
friend mint operator - (mint a, mint b) { return a.x - b.x; }
friend mint operator * (mint a, mint b) { return (ll) a.x * b.x; }
template <typename __Tp>
friend mint operator ^ (mint a, __Tp b) {
mint ans = 1;
while (b) {
if (b & 1) ans *= a;
a *= a, b >>= 1;
}
return ans;
}
friend mint operator / (mint a, mint b) { return a * (b ^ (mod - 2)); }
friend mint & operator += (mint & a, mint b) { return a = a + b; }
friend mint & operator -= (mint & a, mint b) { return a = a - b; }
friend mint & operator *= (mint & a, mint b) { return a = a * b; }
template <typename __Tp>
friend mint & operator ^= (mint & a, __Tp b) { return a = a ^ b; }
friend mint & operator /= (mint & a, mint b) { return a = a / b; }
#undef fix
};
typedef mint <mod> mi;
int n, m, e[20], vld[1 << 18], popcnt[1 << 18], lg[1 << 18];
mi f[1 << 18];
int main() {
read(n, m);
for (int i = 1; i <= m; ++i) {
int u, v; read(u, v), --u, --v;
e[u] |= (1 << v), e[v] |= (1 << u);
}
int S = (1 << n) - 1;
for (int i = 0; i < n; ++i) lg[1 << i] = i;
vld[0] = 1;
for (int s = 1; s <= S; ++s) {
int i = lg[s & -s];
popcnt[s] = popcnt[s & (s - 1)] + 1;
vld[s] = vld[s & (s - 1)] & !(e[i] & s);
}
f[0] = 1;
for (int s = 1; s <= S; ++s)
for (int t = s; t; t = (t - 1) & s)
if (vld[t]) f[s] += f[s ^ t] * (popcnt[t] & 1 ? 1 : -1);
mi ans = f[S] * m / 2;
write(ans.x, '\n');
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1236 KB |
Output is correct |
2 |
Correct |
1 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1236 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1236 KB |
Output is correct |
2 |
Correct |
1 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1236 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1236 KB |
Output is correct |
14 |
Correct |
1 ms |
1236 KB |
Output is correct |
15 |
Correct |
1 ms |
1236 KB |
Output is correct |
16 |
Correct |
1 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
1236 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1236 KB |
Output is correct |
20 |
Correct |
1 ms |
1236 KB |
Output is correct |
21 |
Correct |
1 ms |
1340 KB |
Output is correct |
22 |
Correct |
1 ms |
1236 KB |
Output is correct |
23 |
Correct |
1 ms |
1236 KB |
Output is correct |
24 |
Correct |
1 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1236 KB |
Output is correct |
2 |
Correct |
1 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1236 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1236 KB |
Output is correct |
14 |
Correct |
1 ms |
1236 KB |
Output is correct |
15 |
Correct |
1 ms |
1236 KB |
Output is correct |
16 |
Correct |
1 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
1236 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1236 KB |
Output is correct |
20 |
Correct |
1 ms |
1236 KB |
Output is correct |
21 |
Correct |
1 ms |
1340 KB |
Output is correct |
22 |
Correct |
1 ms |
1236 KB |
Output is correct |
23 |
Correct |
1 ms |
1236 KB |
Output is correct |
24 |
Correct |
1 ms |
1236 KB |
Output is correct |
25 |
Correct |
1 ms |
1236 KB |
Output is correct |
26 |
Correct |
1 ms |
1236 KB |
Output is correct |
27 |
Correct |
1 ms |
1236 KB |
Output is correct |
28 |
Correct |
1 ms |
1236 KB |
Output is correct |
29 |
Correct |
1 ms |
1236 KB |
Output is correct |
30 |
Correct |
1 ms |
1236 KB |
Output is correct |
31 |
Correct |
1 ms |
1236 KB |
Output is correct |
32 |
Correct |
1 ms |
1236 KB |
Output is correct |
33 |
Correct |
1 ms |
1236 KB |
Output is correct |
34 |
Correct |
1 ms |
1236 KB |
Output is correct |
35 |
Correct |
1 ms |
1236 KB |
Output is correct |
36 |
Correct |
1 ms |
1236 KB |
Output is correct |
37 |
Correct |
1 ms |
1236 KB |
Output is correct |
38 |
Correct |
1 ms |
1236 KB |
Output is correct |
39 |
Correct |
1 ms |
1236 KB |
Output is correct |
40 |
Correct |
1 ms |
1236 KB |
Output is correct |
41 |
Correct |
1 ms |
1236 KB |
Output is correct |
42 |
Correct |
1 ms |
1236 KB |
Output is correct |
43 |
Correct |
1 ms |
1236 KB |
Output is correct |
44 |
Correct |
1 ms |
1236 KB |
Output is correct |
45 |
Correct |
1 ms |
1236 KB |
Output is correct |
46 |
Correct |
1 ms |
1236 KB |
Output is correct |
47 |
Correct |
1 ms |
1236 KB |
Output is correct |
48 |
Correct |
1 ms |
1236 KB |
Output is correct |
49 |
Correct |
1 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
1236 KB |
Output is correct |
51 |
Correct |
1 ms |
1236 KB |
Output is correct |
52 |
Correct |
1 ms |
1236 KB |
Output is correct |
53 |
Correct |
1 ms |
1236 KB |
Output is correct |
54 |
Correct |
1 ms |
1236 KB |
Output is correct |
55 |
Correct |
1 ms |
1236 KB |
Output is correct |
56 |
Correct |
1 ms |
1236 KB |
Output is correct |
57 |
Correct |
1 ms |
1236 KB |
Output is correct |
58 |
Correct |
1 ms |
1236 KB |
Output is correct |
59 |
Correct |
1 ms |
1236 KB |
Output is correct |
60 |
Correct |
1 ms |
1236 KB |
Output is correct |
61 |
Correct |
2 ms |
1352 KB |
Output is correct |
62 |
Correct |
1 ms |
1236 KB |
Output is correct |
63 |
Correct |
1 ms |
1236 KB |
Output is correct |
64 |
Correct |
1 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1236 KB |
Output is correct |
2 |
Correct |
1 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1236 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1236 KB |
Output is correct |
14 |
Correct |
1 ms |
1236 KB |
Output is correct |
15 |
Correct |
1 ms |
1236 KB |
Output is correct |
16 |
Correct |
1 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
1236 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1236 KB |
Output is correct |
20 |
Correct |
1 ms |
1236 KB |
Output is correct |
21 |
Correct |
1 ms |
1340 KB |
Output is correct |
22 |
Correct |
1 ms |
1236 KB |
Output is correct |
23 |
Correct |
1 ms |
1236 KB |
Output is correct |
24 |
Correct |
1 ms |
1236 KB |
Output is correct |
25 |
Correct |
1 ms |
1236 KB |
Output is correct |
26 |
Correct |
1 ms |
1236 KB |
Output is correct |
27 |
Correct |
1 ms |
1236 KB |
Output is correct |
28 |
Correct |
1 ms |
1236 KB |
Output is correct |
29 |
Correct |
1 ms |
1236 KB |
Output is correct |
30 |
Correct |
1 ms |
1236 KB |
Output is correct |
31 |
Correct |
1 ms |
1236 KB |
Output is correct |
32 |
Correct |
1 ms |
1236 KB |
Output is correct |
33 |
Correct |
1 ms |
1236 KB |
Output is correct |
34 |
Correct |
1 ms |
1236 KB |
Output is correct |
35 |
Correct |
1 ms |
1236 KB |
Output is correct |
36 |
Correct |
1 ms |
1236 KB |
Output is correct |
37 |
Correct |
1 ms |
1236 KB |
Output is correct |
38 |
Correct |
1 ms |
1236 KB |
Output is correct |
39 |
Correct |
1 ms |
1236 KB |
Output is correct |
40 |
Correct |
1 ms |
1236 KB |
Output is correct |
41 |
Correct |
1 ms |
1236 KB |
Output is correct |
42 |
Correct |
1 ms |
1236 KB |
Output is correct |
43 |
Correct |
1 ms |
1236 KB |
Output is correct |
44 |
Correct |
1 ms |
1236 KB |
Output is correct |
45 |
Correct |
1 ms |
1236 KB |
Output is correct |
46 |
Correct |
1 ms |
1236 KB |
Output is correct |
47 |
Correct |
1 ms |
1236 KB |
Output is correct |
48 |
Correct |
1 ms |
1236 KB |
Output is correct |
49 |
Correct |
1 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
1236 KB |
Output is correct |
51 |
Correct |
1 ms |
1236 KB |
Output is correct |
52 |
Correct |
1 ms |
1236 KB |
Output is correct |
53 |
Correct |
1 ms |
1236 KB |
Output is correct |
54 |
Correct |
1 ms |
1236 KB |
Output is correct |
55 |
Correct |
1 ms |
1236 KB |
Output is correct |
56 |
Correct |
1 ms |
1236 KB |
Output is correct |
57 |
Correct |
1 ms |
1236 KB |
Output is correct |
58 |
Correct |
1 ms |
1236 KB |
Output is correct |
59 |
Correct |
1 ms |
1236 KB |
Output is correct |
60 |
Correct |
1 ms |
1236 KB |
Output is correct |
61 |
Correct |
2 ms |
1352 KB |
Output is correct |
62 |
Correct |
1 ms |
1236 KB |
Output is correct |
63 |
Correct |
1 ms |
1236 KB |
Output is correct |
64 |
Correct |
1 ms |
1236 KB |
Output is correct |
65 |
Correct |
12 ms |
1480 KB |
Output is correct |
66 |
Correct |
12 ms |
1364 KB |
Output is correct |
67 |
Correct |
10 ms |
1364 KB |
Output is correct |
68 |
Correct |
11 ms |
1484 KB |
Output is correct |
69 |
Correct |
32 ms |
1484 KB |
Output is correct |
70 |
Correct |
22 ms |
1484 KB |
Output is correct |
71 |
Correct |
23 ms |
1480 KB |
Output is correct |
72 |
Correct |
24 ms |
1364 KB |
Output is correct |
73 |
Correct |
16 ms |
1484 KB |
Output is correct |
74 |
Correct |
17 ms |
1484 KB |
Output is correct |
75 |
Correct |
18 ms |
1492 KB |
Output is correct |
76 |
Correct |
20 ms |
1536 KB |
Output is correct |
77 |
Correct |
38 ms |
1556 KB |
Output is correct |
78 |
Correct |
33 ms |
1600 KB |
Output is correct |
79 |
Correct |
34 ms |
1620 KB |
Output is correct |
80 |
Correct |
28 ms |
1620 KB |
Output is correct |
81 |
Correct |
26 ms |
1612 KB |
Output is correct |
82 |
Correct |
24 ms |
1616 KB |
Output is correct |
83 |
Correct |
22 ms |
1492 KB |
Output is correct |
84 |
Correct |
22 ms |
1612 KB |
Output is correct |
85 |
Correct |
92 ms |
1492 KB |
Output is correct |
86 |
Correct |
63 ms |
1492 KB |
Output is correct |
87 |
Correct |
68 ms |
1592 KB |
Output is correct |
88 |
Correct |
71 ms |
1592 KB |
Output is correct |
89 |
Correct |
45 ms |
1592 KB |
Output is correct |
90 |
Correct |
47 ms |
1492 KB |
Output is correct |
91 |
Correct |
50 ms |
1592 KB |
Output is correct |
92 |
Correct |
54 ms |
1592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1236 KB |
Output is correct |
2 |
Correct |
1 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1236 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1236 KB |
Output is correct |
7 |
Correct |
1 ms |
1236 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1236 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1236 KB |
Output is correct |
14 |
Correct |
1 ms |
1236 KB |
Output is correct |
15 |
Correct |
1 ms |
1236 KB |
Output is correct |
16 |
Correct |
1 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
1236 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1236 KB |
Output is correct |
20 |
Correct |
1 ms |
1236 KB |
Output is correct |
21 |
Correct |
1 ms |
1340 KB |
Output is correct |
22 |
Correct |
1 ms |
1236 KB |
Output is correct |
23 |
Correct |
1 ms |
1236 KB |
Output is correct |
24 |
Correct |
1 ms |
1236 KB |
Output is correct |
25 |
Correct |
1 ms |
1236 KB |
Output is correct |
26 |
Correct |
1 ms |
1236 KB |
Output is correct |
27 |
Correct |
1 ms |
1236 KB |
Output is correct |
28 |
Correct |
1 ms |
1236 KB |
Output is correct |
29 |
Correct |
1 ms |
1236 KB |
Output is correct |
30 |
Correct |
1 ms |
1236 KB |
Output is correct |
31 |
Correct |
1 ms |
1236 KB |
Output is correct |
32 |
Correct |
1 ms |
1236 KB |
Output is correct |
33 |
Correct |
1 ms |
1236 KB |
Output is correct |
34 |
Correct |
1 ms |
1236 KB |
Output is correct |
35 |
Correct |
1 ms |
1236 KB |
Output is correct |
36 |
Correct |
1 ms |
1236 KB |
Output is correct |
37 |
Correct |
1 ms |
1236 KB |
Output is correct |
38 |
Correct |
1 ms |
1236 KB |
Output is correct |
39 |
Correct |
1 ms |
1236 KB |
Output is correct |
40 |
Correct |
1 ms |
1236 KB |
Output is correct |
41 |
Correct |
1 ms |
1236 KB |
Output is correct |
42 |
Correct |
1 ms |
1236 KB |
Output is correct |
43 |
Correct |
1 ms |
1236 KB |
Output is correct |
44 |
Correct |
1 ms |
1236 KB |
Output is correct |
45 |
Correct |
1 ms |
1236 KB |
Output is correct |
46 |
Correct |
1 ms |
1236 KB |
Output is correct |
47 |
Correct |
1 ms |
1236 KB |
Output is correct |
48 |
Correct |
1 ms |
1236 KB |
Output is correct |
49 |
Correct |
1 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
1236 KB |
Output is correct |
51 |
Correct |
1 ms |
1236 KB |
Output is correct |
52 |
Correct |
1 ms |
1236 KB |
Output is correct |
53 |
Correct |
1 ms |
1236 KB |
Output is correct |
54 |
Correct |
1 ms |
1236 KB |
Output is correct |
55 |
Correct |
1 ms |
1236 KB |
Output is correct |
56 |
Correct |
1 ms |
1236 KB |
Output is correct |
57 |
Correct |
1 ms |
1236 KB |
Output is correct |
58 |
Correct |
1 ms |
1236 KB |
Output is correct |
59 |
Correct |
1 ms |
1236 KB |
Output is correct |
60 |
Correct |
1 ms |
1236 KB |
Output is correct |
61 |
Correct |
2 ms |
1352 KB |
Output is correct |
62 |
Correct |
1 ms |
1236 KB |
Output is correct |
63 |
Correct |
1 ms |
1236 KB |
Output is correct |
64 |
Correct |
1 ms |
1236 KB |
Output is correct |
65 |
Correct |
12 ms |
1480 KB |
Output is correct |
66 |
Correct |
12 ms |
1364 KB |
Output is correct |
67 |
Correct |
10 ms |
1364 KB |
Output is correct |
68 |
Correct |
11 ms |
1484 KB |
Output is correct |
69 |
Correct |
32 ms |
1484 KB |
Output is correct |
70 |
Correct |
22 ms |
1484 KB |
Output is correct |
71 |
Correct |
23 ms |
1480 KB |
Output is correct |
72 |
Correct |
24 ms |
1364 KB |
Output is correct |
73 |
Correct |
16 ms |
1484 KB |
Output is correct |
74 |
Correct |
17 ms |
1484 KB |
Output is correct |
75 |
Correct |
18 ms |
1492 KB |
Output is correct |
76 |
Correct |
20 ms |
1536 KB |
Output is correct |
77 |
Correct |
38 ms |
1556 KB |
Output is correct |
78 |
Correct |
33 ms |
1600 KB |
Output is correct |
79 |
Correct |
34 ms |
1620 KB |
Output is correct |
80 |
Correct |
28 ms |
1620 KB |
Output is correct |
81 |
Correct |
26 ms |
1612 KB |
Output is correct |
82 |
Correct |
24 ms |
1616 KB |
Output is correct |
83 |
Correct |
22 ms |
1492 KB |
Output is correct |
84 |
Correct |
22 ms |
1612 KB |
Output is correct |
85 |
Correct |
92 ms |
1492 KB |
Output is correct |
86 |
Correct |
63 ms |
1492 KB |
Output is correct |
87 |
Correct |
68 ms |
1592 KB |
Output is correct |
88 |
Correct |
71 ms |
1592 KB |
Output is correct |
89 |
Correct |
45 ms |
1592 KB |
Output is correct |
90 |
Correct |
47 ms |
1492 KB |
Output is correct |
91 |
Correct |
50 ms |
1592 KB |
Output is correct |
92 |
Correct |
54 ms |
1592 KB |
Output is correct |
93 |
Correct |
1745 ms |
3388 KB |
Output is correct |
94 |
Correct |
1831 ms |
3456 KB |
Output is correct |
95 |
Correct |
1748 ms |
3400 KB |
Output is correct |
96 |
Correct |
1303 ms |
3392 KB |
Output is correct |
97 |
Correct |
1151 ms |
3392 KB |
Output is correct |
98 |
Correct |
1346 ms |
3388 KB |
Output is correct |
99 |
Correct |
120 ms |
1852 KB |
Output is correct |
100 |
Correct |
123 ms |
1876 KB |
Output is correct |
101 |
Correct |
88 ms |
1860 KB |
Output is correct |
102 |
Correct |
77 ms |
1856 KB |
Output is correct |
103 |
Correct |
1248 ms |
2388 KB |
Output is correct |
104 |
Correct |
649 ms |
2388 KB |
Output is correct |
105 |
Correct |
444 ms |
2388 KB |
Output is correct |
106 |
Correct |
291 ms |
2388 KB |
Output is correct |
107 |
Execution timed out |
3076 ms |
3284 KB |
Time limit exceeded |
108 |
Halted |
0 ms |
0 KB |
- |