답안 #1066708

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1066708 2024-08-20T05:13:50 Z vjudge1 Amusement Park (CEOI19_amusementpark) C++17
100 / 100
797 ms 3668 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bitset<1<<18>indep;
ll dp[1<<18];
const ll mod=998244353;
int EDG[19][19],PC[1<<18];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        EDG[a][b]=1;
        EDG[b][a]=1;
    }
    for(int i=1;i<1<<n;i++){
        vector<int>v;
        for(int j=0;j<n;j++)
            if(i&1<<j)
                v.push_back(j+1);
        int bad=0;
        for(auto k:v)
            for(auto j:v)
                bad|=EDG[k][j];
        indep[i]=!bad;
        PC[i]=__builtin_popcount(i)&1?1:-1;
    }
    dp[0]=1;
    for(int i=1;i<1<<n;i++)
        for(int j=i;j;j=j-1&i)
            dp[i]+=dp[i^j]*PC[j]*indep[j];
    cout<<dp[(1<<n)-1]%mod*((mod+1)/2)%mod*m%mod;
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:31:26: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   31 |         for(int j=i;j;j=j-1&i)
      |                         ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 588 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 588 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 376 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 588 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 376 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 11 ms 604 KB Output is correct
66 Correct 13 ms 584 KB Output is correct
67 Correct 11 ms 600 KB Output is correct
68 Correct 10 ms 604 KB Output is correct
69 Correct 13 ms 652 KB Output is correct
70 Correct 11 ms 612 KB Output is correct
71 Correct 12 ms 604 KB Output is correct
72 Correct 12 ms 500 KB Output is correct
73 Correct 11 ms 604 KB Output is correct
74 Correct 11 ms 540 KB Output is correct
75 Correct 11 ms 532 KB Output is correct
76 Correct 13 ms 524 KB Output is correct
77 Correct 30 ms 604 KB Output is correct
78 Correct 29 ms 680 KB Output is correct
79 Correct 29 ms 604 KB Output is correct
80 Correct 28 ms 796 KB Output is correct
81 Correct 29 ms 820 KB Output is correct
82 Correct 29 ms 604 KB Output is correct
83 Correct 29 ms 860 KB Output is correct
84 Correct 29 ms 604 KB Output is correct
85 Correct 29 ms 768 KB Output is correct
86 Correct 29 ms 712 KB Output is correct
87 Correct 29 ms 600 KB Output is correct
88 Correct 29 ms 604 KB Output is correct
89 Correct 28 ms 828 KB Output is correct
90 Correct 29 ms 604 KB Output is correct
91 Correct 29 ms 604 KB Output is correct
92 Correct 29 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 588 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 376 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 11 ms 604 KB Output is correct
66 Correct 13 ms 584 KB Output is correct
67 Correct 11 ms 600 KB Output is correct
68 Correct 10 ms 604 KB Output is correct
69 Correct 13 ms 652 KB Output is correct
70 Correct 11 ms 612 KB Output is correct
71 Correct 12 ms 604 KB Output is correct
72 Correct 12 ms 500 KB Output is correct
73 Correct 11 ms 604 KB Output is correct
74 Correct 11 ms 540 KB Output is correct
75 Correct 11 ms 532 KB Output is correct
76 Correct 13 ms 524 KB Output is correct
77 Correct 30 ms 604 KB Output is correct
78 Correct 29 ms 680 KB Output is correct
79 Correct 29 ms 604 KB Output is correct
80 Correct 28 ms 796 KB Output is correct
81 Correct 29 ms 820 KB Output is correct
82 Correct 29 ms 604 KB Output is correct
83 Correct 29 ms 860 KB Output is correct
84 Correct 29 ms 604 KB Output is correct
85 Correct 29 ms 768 KB Output is correct
86 Correct 29 ms 712 KB Output is correct
87 Correct 29 ms 600 KB Output is correct
88 Correct 29 ms 604 KB Output is correct
89 Correct 28 ms 828 KB Output is correct
90 Correct 29 ms 604 KB Output is correct
91 Correct 29 ms 604 KB Output is correct
92 Correct 29 ms 604 KB Output is correct
93 Correct 774 ms 3668 KB Output is correct
94 Correct 736 ms 3380 KB Output is correct
95 Correct 750 ms 3396 KB Output is correct
96 Correct 734 ms 3436 KB Output is correct
97 Correct 735 ms 3428 KB Output is correct
98 Correct 744 ms 3664 KB Output is correct
99 Correct 82 ms 1104 KB Output is correct
100 Correct 83 ms 1184 KB Output is correct
101 Correct 81 ms 1156 KB Output is correct
102 Correct 89 ms 1104 KB Output is correct
103 Correct 241 ms 1880 KB Output is correct
104 Correct 247 ms 1872 KB Output is correct
105 Correct 241 ms 1872 KB Output is correct
106 Correct 263 ms 1872 KB Output is correct
107 Correct 781 ms 3492 KB Output is correct
108 Correct 733 ms 3408 KB Output is correct
109 Correct 738 ms 3412 KB Output is correct
110 Correct 737 ms 3332 KB Output is correct
111 Correct 82 ms 1104 KB Output is correct
112 Correct 88 ms 976 KB Output is correct
113 Correct 82 ms 1112 KB Output is correct
114 Correct 82 ms 1104 KB Output is correct
115 Correct 82 ms 1180 KB Output is correct
116 Correct 82 ms 1000 KB Output is correct
117 Correct 82 ms 1104 KB Output is correct
118 Correct 82 ms 1048 KB Output is correct
119 Correct 85 ms 1104 KB Output is correct
120 Correct 81 ms 1104 KB Output is correct
121 Correct 84 ms 1168 KB Output is correct
122 Correct 252 ms 1872 KB Output is correct
123 Correct 240 ms 1872 KB Output is correct
124 Correct 244 ms 1872 KB Output is correct
125 Correct 246 ms 1872 KB Output is correct
126 Correct 246 ms 2208 KB Output is correct
127 Correct 246 ms 1880 KB Output is correct
128 Correct 241 ms 1872 KB Output is correct
129 Correct 240 ms 1876 KB Output is correct
130 Correct 241 ms 1872 KB Output is correct
131 Correct 262 ms 1956 KB Output is correct
132 Correct 245 ms 1876 KB Output is correct
133 Correct 243 ms 1856 KB Output is correct
134 Correct 248 ms 1872 KB Output is correct
135 Correct 248 ms 1976 KB Output is correct
136 Correct 241 ms 1812 KB Output is correct
137 Correct 253 ms 2128 KB Output is correct
138 Correct 247 ms 1876 KB Output is correct
139 Correct 241 ms 1860 KB Output is correct
140 Correct 268 ms 1872 KB Output is correct
141 Correct 246 ms 1872 KB Output is correct
142 Correct 748 ms 3408 KB Output is correct
143 Correct 741 ms 3408 KB Output is correct
144 Correct 797 ms 3408 KB Output is correct
145 Correct 782 ms 3400 KB Output is correct
146 Correct 738 ms 3332 KB Output is correct
147 Correct 726 ms 3412 KB Output is correct
148 Correct 742 ms 3408 KB Output is correct
149 Correct 761 ms 3408 KB Output is correct
150 Correct 759 ms 3408 KB Output is correct
151 Correct 742 ms 3532 KB Output is correct
152 Correct 756 ms 3536 KB Output is correct
153 Correct 735 ms 3332 KB Output is correct
154 Correct 757 ms 3412 KB Output is correct
155 Correct 739 ms 3332 KB Output is correct
156 Correct 741 ms 3536 KB Output is correct
157 Correct 743 ms 3300 KB Output is correct
158 Correct 748 ms 3488 KB Output is correct
159 Correct 751 ms 3296 KB Output is correct
160 Correct 758 ms 3412 KB Output is correct
161 Correct 785 ms 3320 KB Output is correct
162 Correct 765 ms 3476 KB Output is correct
163 Correct 741 ms 3408 KB Output is correct
164 Correct 740 ms 3408 KB Output is correct
165 Correct 773 ms 3412 KB Output is correct
166 Correct 737 ms 3408 KB Output is correct
167 Correct 740 ms 3412 KB Output is correct