#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=998244353;
int inf=1000000007;
ll infl=1000000000000000007;
const int N=18;
unordered_map<int,int>DP[(1<<N)];
vector<int>inside[(1<<N)];
int G[N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m,a,b;
cin>>n>>m;
for(int i=0;i<m;i++)
{
cin>>a>>b;
a--,b--;
G[a]^=(1<<b);
G[b]^=(1<<a);
}
for(int i=0;i<(1<<n);i++)
{
for(int j=0;j<n;j++) if(i&(1<<j)) inside[i].pb(j);
}
DP[0][(1<<n)-1]=1;
for(int a=0;a<(1<<n);a++)
{
int d=(1<<n)-1-a;
for(int b=d;b>0;b=(b-1)&d)
{
int x=DP[a][b];
if(x==0) continue;
for(auto k:inside[b])
{
int A=a^(1<<k),B=(b&((1<<n)-(1<<(k+1))))|(G[k]&((1<<n)-1-a-(1<<k)));
int y=DP[A][B];
y+=x;
if(y>=mod) y-=mod;
DP[A][B]=y;
}
}
}
cout<<(ll)DP[(1<<n)-1][0]*(ll)m%mod*499122177%mod;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
20820 KB |
Output is correct |
2 |
Correct |
14 ms |
20772 KB |
Output is correct |
3 |
Correct |
12 ms |
20840 KB |
Output is correct |
4 |
Correct |
13 ms |
20820 KB |
Output is correct |
5 |
Correct |
12 ms |
20820 KB |
Output is correct |
6 |
Correct |
12 ms |
20752 KB |
Output is correct |
7 |
Correct |
12 ms |
20820 KB |
Output is correct |
8 |
Correct |
13 ms |
20820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
20820 KB |
Output is correct |
2 |
Correct |
14 ms |
20772 KB |
Output is correct |
3 |
Correct |
12 ms |
20840 KB |
Output is correct |
4 |
Correct |
13 ms |
20820 KB |
Output is correct |
5 |
Correct |
12 ms |
20820 KB |
Output is correct |
6 |
Correct |
12 ms |
20752 KB |
Output is correct |
7 |
Correct |
12 ms |
20820 KB |
Output is correct |
8 |
Correct |
13 ms |
20820 KB |
Output is correct |
9 |
Correct |
12 ms |
20836 KB |
Output is correct |
10 |
Correct |
12 ms |
20792 KB |
Output is correct |
11 |
Correct |
15 ms |
20836 KB |
Output is correct |
12 |
Correct |
15 ms |
20764 KB |
Output is correct |
13 |
Correct |
12 ms |
20828 KB |
Output is correct |
14 |
Correct |
13 ms |
20820 KB |
Output is correct |
15 |
Correct |
15 ms |
20820 KB |
Output is correct |
16 |
Correct |
16 ms |
20820 KB |
Output is correct |
17 |
Correct |
12 ms |
20820 KB |
Output is correct |
18 |
Correct |
15 ms |
20840 KB |
Output is correct |
19 |
Correct |
11 ms |
20820 KB |
Output is correct |
20 |
Correct |
14 ms |
20856 KB |
Output is correct |
21 |
Correct |
16 ms |
20820 KB |
Output is correct |
22 |
Correct |
12 ms |
20820 KB |
Output is correct |
23 |
Correct |
16 ms |
20836 KB |
Output is correct |
24 |
Correct |
15 ms |
20820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
20820 KB |
Output is correct |
2 |
Correct |
14 ms |
20772 KB |
Output is correct |
3 |
Correct |
12 ms |
20840 KB |
Output is correct |
4 |
Correct |
13 ms |
20820 KB |
Output is correct |
5 |
Correct |
12 ms |
20820 KB |
Output is correct |
6 |
Correct |
12 ms |
20752 KB |
Output is correct |
7 |
Correct |
12 ms |
20820 KB |
Output is correct |
8 |
Correct |
13 ms |
20820 KB |
Output is correct |
9 |
Correct |
12 ms |
20836 KB |
Output is correct |
10 |
Correct |
12 ms |
20792 KB |
Output is correct |
11 |
Correct |
15 ms |
20836 KB |
Output is correct |
12 |
Correct |
15 ms |
20764 KB |
Output is correct |
13 |
Correct |
12 ms |
20828 KB |
Output is correct |
14 |
Correct |
13 ms |
20820 KB |
Output is correct |
15 |
Correct |
15 ms |
20820 KB |
Output is correct |
16 |
Correct |
16 ms |
20820 KB |
Output is correct |
17 |
Correct |
12 ms |
20820 KB |
Output is correct |
18 |
Correct |
15 ms |
20840 KB |
Output is correct |
19 |
Correct |
11 ms |
20820 KB |
Output is correct |
20 |
Correct |
14 ms |
20856 KB |
Output is correct |
21 |
Correct |
16 ms |
20820 KB |
Output is correct |
22 |
Correct |
12 ms |
20820 KB |
Output is correct |
23 |
Correct |
16 ms |
20836 KB |
Output is correct |
24 |
Correct |
15 ms |
20820 KB |
Output is correct |
25 |
Correct |
14 ms |
20896 KB |
Output is correct |
26 |
Correct |
16 ms |
20868 KB |
Output is correct |
27 |
Correct |
16 ms |
20820 KB |
Output is correct |
28 |
Correct |
16 ms |
20844 KB |
Output is correct |
29 |
Correct |
13 ms |
20820 KB |
Output is correct |
30 |
Correct |
15 ms |
20912 KB |
Output is correct |
31 |
Correct |
16 ms |
20844 KB |
Output is correct |
32 |
Correct |
13 ms |
21144 KB |
Output is correct |
33 |
Correct |
12 ms |
21076 KB |
Output is correct |
34 |
Correct |
14 ms |
21020 KB |
Output is correct |
35 |
Correct |
15 ms |
21096 KB |
Output is correct |
36 |
Correct |
16 ms |
21140 KB |
Output is correct |
37 |
Correct |
15 ms |
21140 KB |
Output is correct |
38 |
Correct |
13 ms |
21096 KB |
Output is correct |
39 |
Correct |
14 ms |
21716 KB |
Output is correct |
40 |
Correct |
19 ms |
21748 KB |
Output is correct |
41 |
Correct |
17 ms |
21780 KB |
Output is correct |
42 |
Correct |
14 ms |
21604 KB |
Output is correct |
43 |
Correct |
17 ms |
21612 KB |
Output is correct |
44 |
Correct |
14 ms |
21604 KB |
Output is correct |
45 |
Correct |
16 ms |
21712 KB |
Output is correct |
46 |
Correct |
14 ms |
21588 KB |
Output is correct |
47 |
Correct |
13 ms |
21588 KB |
Output is correct |
48 |
Correct |
14 ms |
21784 KB |
Output is correct |
49 |
Correct |
14 ms |
21624 KB |
Output is correct |
50 |
Correct |
17 ms |
21588 KB |
Output is correct |
51 |
Correct |
14 ms |
21588 KB |
Output is correct |
52 |
Correct |
20 ms |
23380 KB |
Output is correct |
53 |
Correct |
22 ms |
23380 KB |
Output is correct |
54 |
Correct |
19 ms |
23376 KB |
Output is correct |
55 |
Correct |
20 ms |
23252 KB |
Output is correct |
56 |
Correct |
21 ms |
23296 KB |
Output is correct |
57 |
Correct |
18 ms |
23272 KB |
Output is correct |
58 |
Correct |
18 ms |
23268 KB |
Output is correct |
59 |
Correct |
18 ms |
23252 KB |
Output is correct |
60 |
Correct |
21 ms |
23268 KB |
Output is correct |
61 |
Correct |
19 ms |
23380 KB |
Output is correct |
62 |
Correct |
20 ms |
23380 KB |
Output is correct |
63 |
Correct |
25 ms |
23400 KB |
Output is correct |
64 |
Correct |
26 ms |
23252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
20820 KB |
Output is correct |
2 |
Correct |
14 ms |
20772 KB |
Output is correct |
3 |
Correct |
12 ms |
20840 KB |
Output is correct |
4 |
Correct |
13 ms |
20820 KB |
Output is correct |
5 |
Correct |
12 ms |
20820 KB |
Output is correct |
6 |
Correct |
12 ms |
20752 KB |
Output is correct |
7 |
Correct |
12 ms |
20820 KB |
Output is correct |
8 |
Correct |
13 ms |
20820 KB |
Output is correct |
9 |
Correct |
12 ms |
20836 KB |
Output is correct |
10 |
Correct |
12 ms |
20792 KB |
Output is correct |
11 |
Correct |
15 ms |
20836 KB |
Output is correct |
12 |
Correct |
15 ms |
20764 KB |
Output is correct |
13 |
Correct |
12 ms |
20828 KB |
Output is correct |
14 |
Correct |
13 ms |
20820 KB |
Output is correct |
15 |
Correct |
15 ms |
20820 KB |
Output is correct |
16 |
Correct |
16 ms |
20820 KB |
Output is correct |
17 |
Correct |
12 ms |
20820 KB |
Output is correct |
18 |
Correct |
15 ms |
20840 KB |
Output is correct |
19 |
Correct |
11 ms |
20820 KB |
Output is correct |
20 |
Correct |
14 ms |
20856 KB |
Output is correct |
21 |
Correct |
16 ms |
20820 KB |
Output is correct |
22 |
Correct |
12 ms |
20820 KB |
Output is correct |
23 |
Correct |
16 ms |
20836 KB |
Output is correct |
24 |
Correct |
15 ms |
20820 KB |
Output is correct |
25 |
Correct |
14 ms |
20896 KB |
Output is correct |
26 |
Correct |
16 ms |
20868 KB |
Output is correct |
27 |
Correct |
16 ms |
20820 KB |
Output is correct |
28 |
Correct |
16 ms |
20844 KB |
Output is correct |
29 |
Correct |
13 ms |
20820 KB |
Output is correct |
30 |
Correct |
15 ms |
20912 KB |
Output is correct |
31 |
Correct |
16 ms |
20844 KB |
Output is correct |
32 |
Correct |
13 ms |
21144 KB |
Output is correct |
33 |
Correct |
12 ms |
21076 KB |
Output is correct |
34 |
Correct |
14 ms |
21020 KB |
Output is correct |
35 |
Correct |
15 ms |
21096 KB |
Output is correct |
36 |
Correct |
16 ms |
21140 KB |
Output is correct |
37 |
Correct |
15 ms |
21140 KB |
Output is correct |
38 |
Correct |
13 ms |
21096 KB |
Output is correct |
39 |
Correct |
14 ms |
21716 KB |
Output is correct |
40 |
Correct |
19 ms |
21748 KB |
Output is correct |
41 |
Correct |
17 ms |
21780 KB |
Output is correct |
42 |
Correct |
14 ms |
21604 KB |
Output is correct |
43 |
Correct |
17 ms |
21612 KB |
Output is correct |
44 |
Correct |
14 ms |
21604 KB |
Output is correct |
45 |
Correct |
16 ms |
21712 KB |
Output is correct |
46 |
Correct |
14 ms |
21588 KB |
Output is correct |
47 |
Correct |
13 ms |
21588 KB |
Output is correct |
48 |
Correct |
14 ms |
21784 KB |
Output is correct |
49 |
Correct |
14 ms |
21624 KB |
Output is correct |
50 |
Correct |
17 ms |
21588 KB |
Output is correct |
51 |
Correct |
14 ms |
21588 KB |
Output is correct |
52 |
Correct |
20 ms |
23380 KB |
Output is correct |
53 |
Correct |
22 ms |
23380 KB |
Output is correct |
54 |
Correct |
19 ms |
23376 KB |
Output is correct |
55 |
Correct |
20 ms |
23252 KB |
Output is correct |
56 |
Correct |
21 ms |
23296 KB |
Output is correct |
57 |
Correct |
18 ms |
23272 KB |
Output is correct |
58 |
Correct |
18 ms |
23268 KB |
Output is correct |
59 |
Correct |
18 ms |
23252 KB |
Output is correct |
60 |
Correct |
21 ms |
23268 KB |
Output is correct |
61 |
Correct |
19 ms |
23380 KB |
Output is correct |
62 |
Correct |
20 ms |
23380 KB |
Output is correct |
63 |
Correct |
25 ms |
23400 KB |
Output is correct |
64 |
Correct |
26 ms |
23252 KB |
Output is correct |
65 |
Correct |
541 ms |
213892 KB |
Output is correct |
66 |
Correct |
544 ms |
213840 KB |
Output is correct |
67 |
Correct |
592 ms |
213704 KB |
Output is correct |
68 |
Correct |
568 ms |
213704 KB |
Output is correct |
69 |
Correct |
509 ms |
214600 KB |
Output is correct |
70 |
Correct |
546 ms |
214120 KB |
Output is correct |
71 |
Correct |
507 ms |
214052 KB |
Output is correct |
72 |
Correct |
563 ms |
214036 KB |
Output is correct |
73 |
Correct |
514 ms |
213820 KB |
Output is correct |
74 |
Correct |
520 ms |
213836 KB |
Output is correct |
75 |
Correct |
523 ms |
213924 KB |
Output is correct |
76 |
Correct |
505 ms |
213836 KB |
Output is correct |
77 |
Correct |
1503 ms |
600280 KB |
Output is correct |
78 |
Correct |
1568 ms |
600004 KB |
Output is correct |
79 |
Correct |
1524 ms |
599620 KB |
Output is correct |
80 |
Correct |
1507 ms |
599612 KB |
Output is correct |
81 |
Correct |
1541 ms |
599960 KB |
Output is correct |
82 |
Correct |
1542 ms |
599540 KB |
Output is correct |
83 |
Correct |
1507 ms |
599808 KB |
Output is correct |
84 |
Correct |
1477 ms |
599576 KB |
Output is correct |
85 |
Correct |
1784 ms |
601544 KB |
Output is correct |
86 |
Correct |
1436 ms |
600684 KB |
Output is correct |
87 |
Correct |
1439 ms |
600488 KB |
Output is correct |
88 |
Correct |
1427 ms |
600440 KB |
Output is correct |
89 |
Correct |
1440 ms |
600140 KB |
Output is correct |
90 |
Correct |
1464 ms |
599856 KB |
Output is correct |
91 |
Correct |
1452 ms |
600048 KB |
Output is correct |
92 |
Correct |
1432 ms |
600024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
20820 KB |
Output is correct |
2 |
Correct |
14 ms |
20772 KB |
Output is correct |
3 |
Correct |
12 ms |
20840 KB |
Output is correct |
4 |
Correct |
13 ms |
20820 KB |
Output is correct |
5 |
Correct |
12 ms |
20820 KB |
Output is correct |
6 |
Correct |
12 ms |
20752 KB |
Output is correct |
7 |
Correct |
12 ms |
20820 KB |
Output is correct |
8 |
Correct |
13 ms |
20820 KB |
Output is correct |
9 |
Correct |
12 ms |
20836 KB |
Output is correct |
10 |
Correct |
12 ms |
20792 KB |
Output is correct |
11 |
Correct |
15 ms |
20836 KB |
Output is correct |
12 |
Correct |
15 ms |
20764 KB |
Output is correct |
13 |
Correct |
12 ms |
20828 KB |
Output is correct |
14 |
Correct |
13 ms |
20820 KB |
Output is correct |
15 |
Correct |
15 ms |
20820 KB |
Output is correct |
16 |
Correct |
16 ms |
20820 KB |
Output is correct |
17 |
Correct |
12 ms |
20820 KB |
Output is correct |
18 |
Correct |
15 ms |
20840 KB |
Output is correct |
19 |
Correct |
11 ms |
20820 KB |
Output is correct |
20 |
Correct |
14 ms |
20856 KB |
Output is correct |
21 |
Correct |
16 ms |
20820 KB |
Output is correct |
22 |
Correct |
12 ms |
20820 KB |
Output is correct |
23 |
Correct |
16 ms |
20836 KB |
Output is correct |
24 |
Correct |
15 ms |
20820 KB |
Output is correct |
25 |
Correct |
14 ms |
20896 KB |
Output is correct |
26 |
Correct |
16 ms |
20868 KB |
Output is correct |
27 |
Correct |
16 ms |
20820 KB |
Output is correct |
28 |
Correct |
16 ms |
20844 KB |
Output is correct |
29 |
Correct |
13 ms |
20820 KB |
Output is correct |
30 |
Correct |
15 ms |
20912 KB |
Output is correct |
31 |
Correct |
16 ms |
20844 KB |
Output is correct |
32 |
Correct |
13 ms |
21144 KB |
Output is correct |
33 |
Correct |
12 ms |
21076 KB |
Output is correct |
34 |
Correct |
14 ms |
21020 KB |
Output is correct |
35 |
Correct |
15 ms |
21096 KB |
Output is correct |
36 |
Correct |
16 ms |
21140 KB |
Output is correct |
37 |
Correct |
15 ms |
21140 KB |
Output is correct |
38 |
Correct |
13 ms |
21096 KB |
Output is correct |
39 |
Correct |
14 ms |
21716 KB |
Output is correct |
40 |
Correct |
19 ms |
21748 KB |
Output is correct |
41 |
Correct |
17 ms |
21780 KB |
Output is correct |
42 |
Correct |
14 ms |
21604 KB |
Output is correct |
43 |
Correct |
17 ms |
21612 KB |
Output is correct |
44 |
Correct |
14 ms |
21604 KB |
Output is correct |
45 |
Correct |
16 ms |
21712 KB |
Output is correct |
46 |
Correct |
14 ms |
21588 KB |
Output is correct |
47 |
Correct |
13 ms |
21588 KB |
Output is correct |
48 |
Correct |
14 ms |
21784 KB |
Output is correct |
49 |
Correct |
14 ms |
21624 KB |
Output is correct |
50 |
Correct |
17 ms |
21588 KB |
Output is correct |
51 |
Correct |
14 ms |
21588 KB |
Output is correct |
52 |
Correct |
20 ms |
23380 KB |
Output is correct |
53 |
Correct |
22 ms |
23380 KB |
Output is correct |
54 |
Correct |
19 ms |
23376 KB |
Output is correct |
55 |
Correct |
20 ms |
23252 KB |
Output is correct |
56 |
Correct |
21 ms |
23296 KB |
Output is correct |
57 |
Correct |
18 ms |
23272 KB |
Output is correct |
58 |
Correct |
18 ms |
23268 KB |
Output is correct |
59 |
Correct |
18 ms |
23252 KB |
Output is correct |
60 |
Correct |
21 ms |
23268 KB |
Output is correct |
61 |
Correct |
19 ms |
23380 KB |
Output is correct |
62 |
Correct |
20 ms |
23380 KB |
Output is correct |
63 |
Correct |
25 ms |
23400 KB |
Output is correct |
64 |
Correct |
26 ms |
23252 KB |
Output is correct |
65 |
Correct |
541 ms |
213892 KB |
Output is correct |
66 |
Correct |
544 ms |
213840 KB |
Output is correct |
67 |
Correct |
592 ms |
213704 KB |
Output is correct |
68 |
Correct |
568 ms |
213704 KB |
Output is correct |
69 |
Correct |
509 ms |
214600 KB |
Output is correct |
70 |
Correct |
546 ms |
214120 KB |
Output is correct |
71 |
Correct |
507 ms |
214052 KB |
Output is correct |
72 |
Correct |
563 ms |
214036 KB |
Output is correct |
73 |
Correct |
514 ms |
213820 KB |
Output is correct |
74 |
Correct |
520 ms |
213836 KB |
Output is correct |
75 |
Correct |
523 ms |
213924 KB |
Output is correct |
76 |
Correct |
505 ms |
213836 KB |
Output is correct |
77 |
Correct |
1503 ms |
600280 KB |
Output is correct |
78 |
Correct |
1568 ms |
600004 KB |
Output is correct |
79 |
Correct |
1524 ms |
599620 KB |
Output is correct |
80 |
Correct |
1507 ms |
599612 KB |
Output is correct |
81 |
Correct |
1541 ms |
599960 KB |
Output is correct |
82 |
Correct |
1542 ms |
599540 KB |
Output is correct |
83 |
Correct |
1507 ms |
599808 KB |
Output is correct |
84 |
Correct |
1477 ms |
599576 KB |
Output is correct |
85 |
Correct |
1784 ms |
601544 KB |
Output is correct |
86 |
Correct |
1436 ms |
600684 KB |
Output is correct |
87 |
Correct |
1439 ms |
600488 KB |
Output is correct |
88 |
Correct |
1427 ms |
600440 KB |
Output is correct |
89 |
Correct |
1440 ms |
600140 KB |
Output is correct |
90 |
Correct |
1464 ms |
599856 KB |
Output is correct |
91 |
Correct |
1452 ms |
600048 KB |
Output is correct |
92 |
Correct |
1432 ms |
600024 KB |
Output is correct |
93 |
Runtime error |
1662 ms |
1048576 KB |
Execution killed with signal 9 |
94 |
Halted |
0 ms |
0 KB |
- |