답안 #698981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698981 2023-02-15T07:01:03 Z vjudge1 Amusement Park (CEOI19_amusementpark) C++14
100 / 100
776 ms 2532 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn=20,maxm=262200;
const int md=998244353,i2=499122177;
int n,m,i,j,u,v,b,f[maxm],g[maxm];
bool e[maxn][maxn];
int main(){
	scanf("%d%d",&n,&m); b=1<<n;
	for(i=1;i<=m;++i){
		scanf("%d%d",&u,&v);
		--u; --v; e[u][v]=e[v][u]=1;
	}
	memset(g,-1,sizeof(g));
	for(i=1;i<b;i<<=1) g[i]=0; f[0]=1;
	for(i=1;i<b;++i){
		if(g[i]){
			if(~g[v=i^(1<<(u=__lg(i&-i)))])
				for(;v;v^=j) if(e[u][__lg(j=v&-v)]) break;
			if(!v) g[i]=!g[i^(1<<u)];
		}
		for(j=i,v=0;j;j=(j-1)&i){
			if(~g[j]){
				u=f[i^j]; if(g[j]) u=md-u;
				v-=((v+=u)>=md)*md;
			}
		}
		f[i]=v;
	}
	printf("%d",1LL*f[b-1]*m%md*i2%md);
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:14:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   14 |  for(i=1;i<b;i<<=1) g[i]=0; f[0]=1;
      |  ^~~
amusementpark.cpp:14:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |  for(i=1;i<b;i<<=1) g[i]=0; f[0]=1;
      |                             ^
amusementpark.cpp:29:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   29 |  printf("%d",1LL*f[b-1]*m%md*i2%md);
      |          ~^  ~~~~~~~~~~~~~~~~~~~~~
      |           |                    |
      |           int                  long long int
      |          %lld
amusementpark.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d%d",&n,&m); b=1<<n;
      |  ~~~~~^~~~~~~~~~~~~~
amusementpark.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d",&u,&v);
      |   ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 1328 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 1332 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 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 1328 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 1332 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1328 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 1328 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 1332 KB Output is correct
17 Correct 1 ms 1328 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 3 ms 1236 KB Output is correct
22 Correct 1 ms 1332 KB Output is correct
23 Correct 1 ms 1328 KB Output is correct
24 Correct 1 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 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 1328 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 1332 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1328 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 1328 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 1332 KB Output is correct
17 Correct 1 ms 1328 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 3 ms 1236 KB Output is correct
22 Correct 1 ms 1332 KB Output is correct
23 Correct 1 ms 1328 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 1328 KB Output is correct
34 Correct 1 ms 1236 KB Output is correct
35 Correct 1 ms 1328 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 1332 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 1332 KB Output is correct
42 Correct 1 ms 1236 KB Output is correct
43 Correct 1 ms 1324 KB Output is correct
44 Correct 1 ms 1236 KB Output is correct
45 Correct 1 ms 1328 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 1328 KB Output is correct
49 Correct 1 ms 1236 KB Output is correct
50 Correct 1 ms 1328 KB Output is correct
51 Correct 1 ms 1332 KB Output is correct
52 Correct 1 ms 1284 KB Output is correct
53 Correct 1 ms 1336 KB Output is correct
54 Correct 2 ms 1236 KB Output is correct
55 Correct 2 ms 1364 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 1332 KB Output is correct
59 Correct 1 ms 1236 KB Output is correct
60 Correct 1 ms 1236 KB Output is correct
61 Correct 1 ms 1236 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 1332 KB Output is correct
# 결과 실행 시간 메모리 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 1328 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 1332 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1328 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 1328 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 1332 KB Output is correct
17 Correct 1 ms 1328 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 3 ms 1236 KB Output is correct
22 Correct 1 ms 1332 KB Output is correct
23 Correct 1 ms 1328 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 1328 KB Output is correct
34 Correct 1 ms 1236 KB Output is correct
35 Correct 1 ms 1328 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 1332 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 1332 KB Output is correct
42 Correct 1 ms 1236 KB Output is correct
43 Correct 1 ms 1324 KB Output is correct
44 Correct 1 ms 1236 KB Output is correct
45 Correct 1 ms 1328 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 1328 KB Output is correct
49 Correct 1 ms 1236 KB Output is correct
50 Correct 1 ms 1328 KB Output is correct
51 Correct 1 ms 1332 KB Output is correct
52 Correct 1 ms 1284 KB Output is correct
53 Correct 1 ms 1336 KB Output is correct
54 Correct 2 ms 1236 KB Output is correct
55 Correct 2 ms 1364 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 1332 KB Output is correct
59 Correct 1 ms 1236 KB Output is correct
60 Correct 1 ms 1236 KB Output is correct
61 Correct 1 ms 1236 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 1332 KB Output is correct
65 Correct 9 ms 1396 KB Output is correct
66 Correct 10 ms 1364 KB Output is correct
67 Correct 9 ms 1368 KB Output is correct
68 Correct 9 ms 1380 KB Output is correct
69 Correct 9 ms 1396 KB Output is correct
70 Correct 8 ms 1364 KB Output is correct
71 Correct 8 ms 1364 KB Output is correct
72 Correct 8 ms 1380 KB Output is correct
73 Correct 7 ms 1332 KB Output is correct
74 Correct 7 ms 1364 KB Output is correct
75 Correct 8 ms 1376 KB Output is correct
76 Correct 7 ms 1376 KB Output is correct
77 Correct 28 ms 1416 KB Output is correct
78 Correct 26 ms 1492 KB Output is correct
79 Correct 25 ms 1408 KB Output is correct
80 Correct 24 ms 1384 KB Output is correct
81 Correct 23 ms 1364 KB Output is correct
82 Correct 24 ms 1492 KB Output is correct
83 Correct 20 ms 1384 KB Output is correct
84 Correct 20 ms 1396 KB Output is correct
85 Correct 24 ms 1364 KB Output is correct
86 Correct 21 ms 1364 KB Output is correct
87 Correct 25 ms 1364 KB Output is correct
88 Correct 22 ms 1416 KB Output is correct
89 Correct 19 ms 1444 KB Output is correct
90 Correct 19 ms 1460 KB Output is correct
91 Correct 21 ms 1444 KB Output is correct
92 Correct 21 ms 1344 KB Output is correct
# 결과 실행 시간 메모리 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 1328 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 1332 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1328 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 1328 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 1332 KB Output is correct
17 Correct 1 ms 1328 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 3 ms 1236 KB Output is correct
22 Correct 1 ms 1332 KB Output is correct
23 Correct 1 ms 1328 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 1328 KB Output is correct
34 Correct 1 ms 1236 KB Output is correct
35 Correct 1 ms 1328 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 1332 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 1332 KB Output is correct
42 Correct 1 ms 1236 KB Output is correct
43 Correct 1 ms 1324 KB Output is correct
44 Correct 1 ms 1236 KB Output is correct
45 Correct 1 ms 1328 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 1328 KB Output is correct
49 Correct 1 ms 1236 KB Output is correct
50 Correct 1 ms 1328 KB Output is correct
51 Correct 1 ms 1332 KB Output is correct
52 Correct 1 ms 1284 KB Output is correct
53 Correct 1 ms 1336 KB Output is correct
54 Correct 2 ms 1236 KB Output is correct
55 Correct 2 ms 1364 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 1332 KB Output is correct
59 Correct 1 ms 1236 KB Output is correct
60 Correct 1 ms 1236 KB Output is correct
61 Correct 1 ms 1236 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 1332 KB Output is correct
65 Correct 9 ms 1396 KB Output is correct
66 Correct 10 ms 1364 KB Output is correct
67 Correct 9 ms 1368 KB Output is correct
68 Correct 9 ms 1380 KB Output is correct
69 Correct 9 ms 1396 KB Output is correct
70 Correct 8 ms 1364 KB Output is correct
71 Correct 8 ms 1364 KB Output is correct
72 Correct 8 ms 1380 KB Output is correct
73 Correct 7 ms 1332 KB Output is correct
74 Correct 7 ms 1364 KB Output is correct
75 Correct 8 ms 1376 KB Output is correct
76 Correct 7 ms 1376 KB Output is correct
77 Correct 28 ms 1416 KB Output is correct
78 Correct 26 ms 1492 KB Output is correct
79 Correct 25 ms 1408 KB Output is correct
80 Correct 24 ms 1384 KB Output is correct
81 Correct 23 ms 1364 KB Output is correct
82 Correct 24 ms 1492 KB Output is correct
83 Correct 20 ms 1384 KB Output is correct
84 Correct 20 ms 1396 KB Output is correct
85 Correct 24 ms 1364 KB Output is correct
86 Correct 21 ms 1364 KB Output is correct
87 Correct 25 ms 1364 KB Output is correct
88 Correct 22 ms 1416 KB Output is correct
89 Correct 19 ms 1444 KB Output is correct
90 Correct 19 ms 1460 KB Output is correct
91 Correct 21 ms 1444 KB Output is correct
92 Correct 21 ms 1344 KB Output is correct
93 Correct 584 ms 2320 KB Output is correct
94 Correct 540 ms 2324 KB Output is correct
95 Correct 634 ms 2308 KB Output is correct
96 Correct 522 ms 2304 KB Output is correct
97 Correct 576 ms 2292 KB Output is correct
98 Correct 557 ms 2464 KB Output is correct
99 Correct 108 ms 1616 KB Output is correct
100 Correct 73 ms 1484 KB Output is correct
101 Correct 70 ms 1624 KB Output is correct
102 Correct 68 ms 1548 KB Output is correct
103 Correct 279 ms 1804 KB Output is correct
104 Correct 220 ms 1704 KB Output is correct
105 Correct 211 ms 1824 KB Output is correct
106 Correct 226 ms 1752 KB Output is correct
107 Correct 776 ms 2532 KB Output is correct
108 Correct 648 ms 2244 KB Output is correct
109 Correct 616 ms 2332 KB Output is correct
110 Correct 564 ms 2328 KB Output is correct
111 Correct 64 ms 1448 KB Output is correct
112 Correct 61 ms 1532 KB Output is correct
113 Correct 56 ms 1572 KB Output is correct
114 Correct 69 ms 1612 KB Output is correct
115 Correct 60 ms 1484 KB Output is correct
116 Correct 63 ms 1484 KB Output is correct
117 Correct 84 ms 1464 KB Output is correct
118 Correct 55 ms 1564 KB Output is correct
119 Correct 72 ms 1564 KB Output is correct
120 Correct 57 ms 1568 KB Output is correct
121 Correct 77 ms 1544 KB Output is correct
122 Correct 199 ms 1812 KB Output is correct
123 Correct 173 ms 1704 KB Output is correct
124 Correct 166 ms 1804 KB Output is correct
125 Correct 171 ms 1764 KB Output is correct
126 Correct 160 ms 1824 KB Output is correct
127 Correct 155 ms 1820 KB Output is correct
128 Correct 155 ms 1800 KB Output is correct
129 Correct 147 ms 1772 KB Output is correct
130 Correct 140 ms 1820 KB Output is correct
131 Correct 205 ms 1820 KB Output is correct
132 Correct 182 ms 1832 KB Output is correct
133 Correct 185 ms 1796 KB Output is correct
134 Correct 183 ms 1824 KB Output is correct
135 Correct 163 ms 1804 KB Output is correct
136 Correct 199 ms 1828 KB Output is correct
137 Correct 162 ms 1772 KB Output is correct
138 Correct 192 ms 1812 KB Output is correct
139 Correct 168 ms 1804 KB Output is correct
140 Correct 180 ms 1816 KB Output is correct
141 Correct 159 ms 1756 KB Output is correct
142 Correct 501 ms 2320 KB Output is correct
143 Correct 516 ms 2420 KB Output is correct
144 Correct 451 ms 2284 KB Output is correct
145 Correct 472 ms 2424 KB Output is correct
146 Correct 424 ms 2332 KB Output is correct
147 Correct 430 ms 2324 KB Output is correct
148 Correct 561 ms 2324 KB Output is correct
149 Correct 507 ms 2448 KB Output is correct
150 Correct 563 ms 2336 KB Output is correct
151 Correct 552 ms 2476 KB Output is correct
152 Correct 508 ms 2332 KB Output is correct
153 Correct 514 ms 2400 KB Output is correct
154 Correct 494 ms 2316 KB Output is correct
155 Correct 533 ms 2464 KB Output is correct
156 Correct 515 ms 2496 KB Output is correct
157 Correct 511 ms 2324 KB Output is correct
158 Correct 493 ms 2348 KB Output is correct
159 Correct 494 ms 2308 KB Output is correct
160 Correct 470 ms 2248 KB Output is correct
161 Correct 496 ms 2336 KB Output is correct
162 Correct 472 ms 2236 KB Output is correct
163 Correct 498 ms 2264 KB Output is correct
164 Correct 459 ms 2336 KB Output is correct
165 Correct 434 ms 2324 KB Output is correct
166 Correct 470 ms 2380 KB Output is correct
167 Correct 457 ms 2436 KB Output is correct