# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
634230 |
2022-08-24T07:24:08 Z |
Mahdi |
Subtree (INOI20_subtree) |
C++17 |
|
318 ms |
1312 KB |
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
const int N=25, M=2e6;
int n, m;
bool g[N][N], a[M];
int main(){
cin>>n>>m;
int ans=0;
for(int i=0;i<m;++i){
int u, v;
cin>>u>>v;
g[--u][--v]=1;
g[v][u]=1;
}
a[0]=1;
for(int i=1;i<(1<<n);++i){
int x=i;
vector<int>w;
for(int j=0;x;++j){
if(x&1)
w.push_back(j);
x>>=1;
}
int t=0;
for(int u: w){
for(int v: w){
if(g[u][v])
++t;
}
}
t/=2;
if(t!=w.size()-1){
continue;
}
for(int u: w){
if(a[i-(1<<u)]){
a[i]=1;
break;
}
}
if(a[i])
++ans;
}
cout<<ans<<'\n';
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:38:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | if(t!=w.size()-1){
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
287 ms |
828 KB |
Output is correct |
9 |
Correct |
281 ms |
684 KB |
Output is correct |
10 |
Correct |
283 ms |
464 KB |
Output is correct |
11 |
Correct |
279 ms |
332 KB |
Output is correct |
12 |
Correct |
133 ms |
376 KB |
Output is correct |
13 |
Correct |
273 ms |
760 KB |
Output is correct |
14 |
Correct |
134 ms |
588 KB |
Output is correct |
15 |
Correct |
130 ms |
516 KB |
Output is correct |
16 |
Correct |
274 ms |
720 KB |
Output is correct |
17 |
Correct |
137 ms |
764 KB |
Output is correct |
18 |
Correct |
134 ms |
492 KB |
Output is correct |
19 |
Correct |
132 ms |
448 KB |
Output is correct |
20 |
Correct |
275 ms |
728 KB |
Output is correct |
21 |
Correct |
279 ms |
556 KB |
Output is correct |
22 |
Correct |
150 ms |
588 KB |
Output is correct |
23 |
Correct |
274 ms |
1312 KB |
Output is correct |
24 |
Correct |
151 ms |
752 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
7 ms |
340 KB |
Output is correct |
29 |
Correct |
131 ms |
588 KB |
Output is correct |
30 |
Correct |
269 ms |
532 KB |
Output is correct |
31 |
Correct |
130 ms |
444 KB |
Output is correct |
32 |
Correct |
138 ms |
584 KB |
Output is correct |
33 |
Correct |
130 ms |
532 KB |
Output is correct |
34 |
Correct |
269 ms |
856 KB |
Output is correct |
35 |
Correct |
276 ms |
560 KB |
Output is correct |
36 |
Correct |
269 ms |
604 KB |
Output is correct |
37 |
Correct |
318 ms |
580 KB |
Output is correct |
38 |
Correct |
269 ms |
448 KB |
Output is correct |
39 |
Correct |
286 ms |
552 KB |
Output is correct |
40 |
Correct |
270 ms |
576 KB |
Output is correct |
41 |
Correct |
283 ms |
496 KB |
Output is correct |
42 |
Correct |
135 ms |
540 KB |
Output is correct |
43 |
Correct |
132 ms |
404 KB |
Output is correct |
44 |
Correct |
273 ms |
748 KB |
Output is correct |
45 |
Correct |
277 ms |
460 KB |
Output is correct |
46 |
Correct |
269 ms |
492 KB |
Output is correct |
47 |
Correct |
293 ms |
580 KB |
Output is correct |
48 |
Correct |
275 ms |
788 KB |
Output is correct |
49 |
Correct |
269 ms |
472 KB |
Output is correct |
50 |
Correct |
273 ms |
704 KB |
Output is correct |
51 |
Correct |
276 ms |
548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
287 ms |
828 KB |
Output is correct |
9 |
Correct |
281 ms |
684 KB |
Output is correct |
10 |
Correct |
283 ms |
464 KB |
Output is correct |
11 |
Correct |
279 ms |
332 KB |
Output is correct |
12 |
Correct |
133 ms |
376 KB |
Output is correct |
13 |
Correct |
273 ms |
760 KB |
Output is correct |
14 |
Correct |
134 ms |
588 KB |
Output is correct |
15 |
Correct |
130 ms |
516 KB |
Output is correct |
16 |
Correct |
274 ms |
720 KB |
Output is correct |
17 |
Correct |
137 ms |
764 KB |
Output is correct |
18 |
Correct |
134 ms |
492 KB |
Output is correct |
19 |
Correct |
132 ms |
448 KB |
Output is correct |
20 |
Correct |
275 ms |
728 KB |
Output is correct |
21 |
Correct |
279 ms |
556 KB |
Output is correct |
22 |
Correct |
150 ms |
588 KB |
Output is correct |
23 |
Correct |
274 ms |
1312 KB |
Output is correct |
24 |
Correct |
151 ms |
752 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
7 ms |
340 KB |
Output is correct |
29 |
Correct |
131 ms |
588 KB |
Output is correct |
30 |
Correct |
269 ms |
532 KB |
Output is correct |
31 |
Correct |
130 ms |
444 KB |
Output is correct |
32 |
Correct |
138 ms |
584 KB |
Output is correct |
33 |
Correct |
130 ms |
532 KB |
Output is correct |
34 |
Correct |
269 ms |
856 KB |
Output is correct |
35 |
Correct |
276 ms |
560 KB |
Output is correct |
36 |
Correct |
269 ms |
604 KB |
Output is correct |
37 |
Correct |
318 ms |
580 KB |
Output is correct |
38 |
Correct |
269 ms |
448 KB |
Output is correct |
39 |
Correct |
286 ms |
552 KB |
Output is correct |
40 |
Correct |
270 ms |
576 KB |
Output is correct |
41 |
Correct |
283 ms |
496 KB |
Output is correct |
42 |
Correct |
135 ms |
540 KB |
Output is correct |
43 |
Correct |
132 ms |
404 KB |
Output is correct |
44 |
Correct |
273 ms |
748 KB |
Output is correct |
45 |
Correct |
277 ms |
460 KB |
Output is correct |
46 |
Correct |
269 ms |
492 KB |
Output is correct |
47 |
Correct |
293 ms |
580 KB |
Output is correct |
48 |
Correct |
275 ms |
788 KB |
Output is correct |
49 |
Correct |
269 ms |
472 KB |
Output is correct |
50 |
Correct |
273 ms |
704 KB |
Output is correct |
51 |
Correct |
276 ms |
548 KB |
Output is correct |
52 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
53 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 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 |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
287 ms |
828 KB |
Output is correct |
9 |
Correct |
281 ms |
684 KB |
Output is correct |
10 |
Correct |
283 ms |
464 KB |
Output is correct |
11 |
Correct |
279 ms |
332 KB |
Output is correct |
12 |
Correct |
133 ms |
376 KB |
Output is correct |
13 |
Correct |
273 ms |
760 KB |
Output is correct |
14 |
Correct |
134 ms |
588 KB |
Output is correct |
15 |
Correct |
130 ms |
516 KB |
Output is correct |
16 |
Correct |
274 ms |
720 KB |
Output is correct |
17 |
Correct |
137 ms |
764 KB |
Output is correct |
18 |
Correct |
134 ms |
492 KB |
Output is correct |
19 |
Correct |
132 ms |
448 KB |
Output is correct |
20 |
Correct |
275 ms |
728 KB |
Output is correct |
21 |
Correct |
279 ms |
556 KB |
Output is correct |
22 |
Correct |
150 ms |
588 KB |
Output is correct |
23 |
Correct |
274 ms |
1312 KB |
Output is correct |
24 |
Correct |
151 ms |
752 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
7 ms |
340 KB |
Output is correct |
29 |
Correct |
131 ms |
588 KB |
Output is correct |
30 |
Correct |
269 ms |
532 KB |
Output is correct |
31 |
Correct |
130 ms |
444 KB |
Output is correct |
32 |
Correct |
138 ms |
584 KB |
Output is correct |
33 |
Correct |
130 ms |
532 KB |
Output is correct |
34 |
Correct |
269 ms |
856 KB |
Output is correct |
35 |
Correct |
276 ms |
560 KB |
Output is correct |
36 |
Correct |
269 ms |
604 KB |
Output is correct |
37 |
Correct |
318 ms |
580 KB |
Output is correct |
38 |
Correct |
269 ms |
448 KB |
Output is correct |
39 |
Correct |
286 ms |
552 KB |
Output is correct |
40 |
Correct |
270 ms |
576 KB |
Output is correct |
41 |
Correct |
283 ms |
496 KB |
Output is correct |
42 |
Correct |
135 ms |
540 KB |
Output is correct |
43 |
Correct |
132 ms |
404 KB |
Output is correct |
44 |
Correct |
273 ms |
748 KB |
Output is correct |
45 |
Correct |
277 ms |
460 KB |
Output is correct |
46 |
Correct |
269 ms |
492 KB |
Output is correct |
47 |
Correct |
293 ms |
580 KB |
Output is correct |
48 |
Correct |
275 ms |
788 KB |
Output is correct |
49 |
Correct |
269 ms |
472 KB |
Output is correct |
50 |
Correct |
273 ms |
704 KB |
Output is correct |
51 |
Correct |
276 ms |
548 KB |
Output is correct |
52 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
53 |
Halted |
0 ms |
0 KB |
- |