답안 #697239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
697239 2023-02-09T00:20:40 Z vjudge1 Amusement Park (CEOI19_amusementpark) C++17
100 / 100
1721 ms 4772 KB
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int N=1001000,mod=998244353;
int n,m,f[N],e[20][20],rc[N];
signed main()
{
    scanf("%lld%lld",&n,&m);
    for(int i=1,x,y;i<=m;i++)
        scanf("%lld%lld",&x,&y),e[x-1][y-1]=e[y-1][x-1]=1;
    f[0]=1;
    for(int i=0;i<(1<<n);i++)
    {
        int sum=(i==0)?0:(__builtin_popcount(i));
        (sum%2==1)?(rc[i]=1):(rc[i]=-1);
        for(int j=0;j<n;j++)
            for(int k=j+1;k<n;k++)
                if(((i>>j)&1)&&((i>>k)&1)&&e[j][k])
                    rc[i]=0;
    }
    for(int i=1;i<(1<<n);i++)
        for(int j=i;j;j=((j-1)&i))
            f[i]=(f[i]+rc[j]*f[i^j]+mod)%mod;
    printf("%lld\n",f[(1<<n)-1]*m%mod*((mod+1)/2)%mod);
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%lld%lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
amusementpark.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%lld%lld",&x,&y),e[x-1][y-1]=e[y-1][x-1]=1;
      |         ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 308 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 312 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 312 KB Output is correct
38 Correct 1 ms 308 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 312 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 308 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 2 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 316 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 1 ms 312 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 3 ms 212 KB Output is correct
64 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 308 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 312 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 312 KB Output is correct
38 Correct 1 ms 308 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 312 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 308 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 2 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 316 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 1 ms 312 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 3 ms 212 KB Output is correct
64 Correct 1 ms 308 KB Output is correct
65 Correct 26 ms 468 KB Output is correct
66 Correct 30 ms 568 KB Output is correct
67 Correct 23 ms 544 KB Output is correct
68 Correct 24 ms 468 KB Output is correct
69 Correct 28 ms 508 KB Output is correct
70 Correct 23 ms 544 KB Output is correct
71 Correct 23 ms 560 KB Output is correct
72 Correct 27 ms 468 KB Output is correct
73 Correct 26 ms 468 KB Output is correct
74 Correct 27 ms 468 KB Output is correct
75 Correct 23 ms 532 KB Output is correct
76 Correct 24 ms 468 KB Output is correct
77 Correct 72 ms 724 KB Output is correct
78 Correct 75 ms 808 KB Output is correct
79 Correct 68 ms 796 KB Output is correct
80 Correct 72 ms 812 KB Output is correct
81 Correct 67 ms 816 KB Output is correct
82 Correct 65 ms 744 KB Output is correct
83 Correct 74 ms 764 KB Output is correct
84 Correct 68 ms 804 KB Output is correct
85 Correct 74 ms 812 KB Output is correct
86 Correct 75 ms 748 KB Output is correct
87 Correct 73 ms 784 KB Output is correct
88 Correct 67 ms 800 KB Output is correct
89 Correct 72 ms 780 KB Output is correct
90 Correct 67 ms 804 KB Output is correct
91 Correct 72 ms 832 KB Output is correct
92 Correct 72 ms 784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 308 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 312 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 312 KB Output is correct
38 Correct 1 ms 308 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 308 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 312 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 308 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 2 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 316 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 1 ms 312 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 3 ms 212 KB Output is correct
64 Correct 1 ms 308 KB Output is correct
65 Correct 26 ms 468 KB Output is correct
66 Correct 30 ms 568 KB Output is correct
67 Correct 23 ms 544 KB Output is correct
68 Correct 24 ms 468 KB Output is correct
69 Correct 28 ms 508 KB Output is correct
70 Correct 23 ms 544 KB Output is correct
71 Correct 23 ms 560 KB Output is correct
72 Correct 27 ms 468 KB Output is correct
73 Correct 26 ms 468 KB Output is correct
74 Correct 27 ms 468 KB Output is correct
75 Correct 23 ms 532 KB Output is correct
76 Correct 24 ms 468 KB Output is correct
77 Correct 72 ms 724 KB Output is correct
78 Correct 75 ms 808 KB Output is correct
79 Correct 68 ms 796 KB Output is correct
80 Correct 72 ms 812 KB Output is correct
81 Correct 67 ms 816 KB Output is correct
82 Correct 65 ms 744 KB Output is correct
83 Correct 74 ms 764 KB Output is correct
84 Correct 68 ms 804 KB Output is correct
85 Correct 74 ms 812 KB Output is correct
86 Correct 75 ms 748 KB Output is correct
87 Correct 73 ms 784 KB Output is correct
88 Correct 67 ms 800 KB Output is correct
89 Correct 72 ms 780 KB Output is correct
90 Correct 67 ms 804 KB Output is correct
91 Correct 72 ms 832 KB Output is correct
92 Correct 72 ms 784 KB Output is correct
93 Correct 1696 ms 4328 KB Output is correct
94 Correct 1635 ms 4332 KB Output is correct
95 Correct 1650 ms 4292 KB Output is correct
96 Correct 1721 ms 4400 KB Output is correct
97 Correct 1624 ms 4396 KB Output is correct
98 Correct 1673 ms 4384 KB Output is correct
99 Correct 186 ms 1384 KB Output is correct
100 Correct 197 ms 1252 KB Output is correct
101 Correct 193 ms 1320 KB Output is correct
102 Correct 186 ms 1260 KB Output is correct
103 Correct 544 ms 2328 KB Output is correct
104 Correct 557 ms 2300 KB Output is correct
105 Correct 560 ms 2356 KB Output is correct
106 Correct 560 ms 2332 KB Output is correct
107 Correct 1632 ms 4284 KB Output is correct
108 Correct 1640 ms 4320 KB Output is correct
109 Correct 1661 ms 4336 KB Output is correct
110 Correct 1712 ms 4324 KB Output is correct
111 Correct 185 ms 1252 KB Output is correct
112 Correct 185 ms 1440 KB Output is correct
113 Correct 183 ms 1224 KB Output is correct
114 Correct 187 ms 1268 KB Output is correct
115 Correct 189 ms 1520 KB Output is correct
116 Correct 188 ms 1220 KB Output is correct
117 Correct 210 ms 1284 KB Output is correct
118 Correct 187 ms 1324 KB Output is correct
119 Correct 188 ms 1348 KB Output is correct
120 Correct 185 ms 1328 KB Output is correct
121 Correct 188 ms 1304 KB Output is correct
122 Correct 569 ms 2344 KB Output is correct
123 Correct 558 ms 2412 KB Output is correct
124 Correct 552 ms 2248 KB Output is correct
125 Correct 575 ms 2348 KB Output is correct
126 Correct 558 ms 2336 KB Output is correct
127 Correct 547 ms 2440 KB Output is correct
128 Correct 543 ms 2432 KB Output is correct
129 Correct 554 ms 2304 KB Output is correct
130 Correct 584 ms 2312 KB Output is correct
131 Correct 553 ms 2360 KB Output is correct
132 Correct 554 ms 2448 KB Output is correct
133 Correct 551 ms 2348 KB Output is correct
134 Correct 559 ms 2400 KB Output is correct
135 Correct 545 ms 2420 KB Output is correct
136 Correct 545 ms 2356 KB Output is correct
137 Correct 552 ms 2244 KB Output is correct
138 Correct 540 ms 2424 KB Output is correct
139 Correct 545 ms 2364 KB Output is correct
140 Correct 567 ms 2316 KB Output is correct
141 Correct 544 ms 2364 KB Output is correct
142 Correct 1616 ms 4496 KB Output is correct
143 Correct 1617 ms 4508 KB Output is correct
144 Correct 1632 ms 4540 KB Output is correct
145 Correct 1627 ms 4528 KB Output is correct
146 Correct 1590 ms 4380 KB Output is correct
147 Correct 1555 ms 4620 KB Output is correct
148 Correct 1571 ms 4560 KB Output is correct
149 Correct 1559 ms 4544 KB Output is correct
150 Correct 1563 ms 4332 KB Output is correct
151 Correct 1560 ms 4384 KB Output is correct
152 Correct 1558 ms 4568 KB Output is correct
153 Correct 1593 ms 4396 KB Output is correct
154 Correct 1554 ms 4772 KB Output is correct
155 Correct 1552 ms 4508 KB Output is correct
156 Correct 1552 ms 4468 KB Output is correct
157 Correct 1570 ms 4300 KB Output is correct
158 Correct 1560 ms 4408 KB Output is correct
159 Correct 1566 ms 4412 KB Output is correct
160 Correct 1578 ms 4396 KB Output is correct
161 Correct 1553 ms 4492 KB Output is correct
162 Correct 1553 ms 4332 KB Output is correct
163 Correct 1585 ms 4496 KB Output is correct
164 Correct 1557 ms 4516 KB Output is correct
165 Correct 1555 ms 4376 KB Output is correct
166 Correct 1571 ms 4436 KB Output is correct
167 Correct 1553 ms 4476 KB Output is correct