#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 10 + 10, inf = 0x3f3f3f3f;
vector<int> grafo[maxn];
int a, b, c;
bool dp[maxn][(1<<(maxn-10))+10];
bool certo;
void dfs(int u, int mask){
if(dp[u][mask]) return;
dp[u][mask] = true;
if(u == c){
certo = (certo || (mask&(1<<a) && mask&(1<<b)));
}else{
for(auto v : grafo[u]){
if(mask&(1<<v)) continue;
dfs(v, mask | (1<<v));
}
}
}
int32_t main(){
ios::sync_with_stdio(false), cin.tie(0);
int n, m;
cin >> n >> m;
for(int i=1;i<=m;i++){
int a, b;
cin >> a >> b;
grafo[a].push_back(b);
grafo[b].push_back(a);
}
int ans=0;
for(a=1;a<=n;a++){
for(b=1;b<=n;b++){
for(c=1;c<=n;c++){
if(a == b || a == c || b == c) continue;
certo = false;
memset(dp, 0, sizeof dp);
dfs(a, 1<<a);
ans += certo;
}
}
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
3 ms |
492 KB |
Output is correct |
6 |
Correct |
4 ms |
548 KB |
Output is correct |
7 |
Correct |
3 ms |
560 KB |
Output is correct |
8 |
Correct |
5 ms |
560 KB |
Output is correct |
9 |
Correct |
35 ms |
688 KB |
Output is correct |
10 |
Correct |
67 ms |
688 KB |
Output is correct |
11 |
Correct |
3 ms |
688 KB |
Output is correct |
12 |
Correct |
4 ms |
688 KB |
Output is correct |
13 |
Correct |
3 ms |
688 KB |
Output is correct |
14 |
Correct |
4 ms |
688 KB |
Output is correct |
15 |
Correct |
4 ms |
688 KB |
Output is correct |
16 |
Correct |
3 ms |
688 KB |
Output is correct |
17 |
Correct |
3 ms |
688 KB |
Output is correct |
18 |
Correct |
3 ms |
688 KB |
Output is correct |
19 |
Correct |
3 ms |
688 KB |
Output is correct |
20 |
Correct |
3 ms |
688 KB |
Output is correct |
21 |
Correct |
3 ms |
688 KB |
Output is correct |
22 |
Correct |
3 ms |
724 KB |
Output is correct |
23 |
Correct |
3 ms |
724 KB |
Output is correct |
24 |
Correct |
3 ms |
724 KB |
Output is correct |
25 |
Correct |
3 ms |
724 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
724 KB |
Output is correct |
28 |
Correct |
3 ms |
724 KB |
Output is correct |
29 |
Correct |
3 ms |
724 KB |
Output is correct |
30 |
Correct |
3 ms |
724 KB |
Output is correct |
31 |
Correct |
4 ms |
724 KB |
Output is correct |
32 |
Correct |
3 ms |
724 KB |
Output is correct |
33 |
Correct |
3 ms |
724 KB |
Output is correct |
34 |
Correct |
4 ms |
724 KB |
Output is correct |
35 |
Correct |
2 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
3 ms |
492 KB |
Output is correct |
6 |
Correct |
4 ms |
548 KB |
Output is correct |
7 |
Correct |
3 ms |
560 KB |
Output is correct |
8 |
Correct |
5 ms |
560 KB |
Output is correct |
9 |
Correct |
35 ms |
688 KB |
Output is correct |
10 |
Correct |
67 ms |
688 KB |
Output is correct |
11 |
Correct |
3 ms |
688 KB |
Output is correct |
12 |
Correct |
4 ms |
688 KB |
Output is correct |
13 |
Correct |
3 ms |
688 KB |
Output is correct |
14 |
Correct |
4 ms |
688 KB |
Output is correct |
15 |
Correct |
4 ms |
688 KB |
Output is correct |
16 |
Correct |
3 ms |
688 KB |
Output is correct |
17 |
Correct |
3 ms |
688 KB |
Output is correct |
18 |
Correct |
3 ms |
688 KB |
Output is correct |
19 |
Correct |
3 ms |
688 KB |
Output is correct |
20 |
Correct |
3 ms |
688 KB |
Output is correct |
21 |
Correct |
3 ms |
688 KB |
Output is correct |
22 |
Correct |
3 ms |
724 KB |
Output is correct |
23 |
Correct |
3 ms |
724 KB |
Output is correct |
24 |
Correct |
3 ms |
724 KB |
Output is correct |
25 |
Correct |
3 ms |
724 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
724 KB |
Output is correct |
28 |
Correct |
3 ms |
724 KB |
Output is correct |
29 |
Correct |
3 ms |
724 KB |
Output is correct |
30 |
Correct |
3 ms |
724 KB |
Output is correct |
31 |
Correct |
4 ms |
724 KB |
Output is correct |
32 |
Correct |
3 ms |
724 KB |
Output is correct |
33 |
Correct |
3 ms |
724 KB |
Output is correct |
34 |
Correct |
4 ms |
724 KB |
Output is correct |
35 |
Correct |
2 ms |
724 KB |
Output is correct |
36 |
Runtime error |
4 ms |
748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
824 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
836 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
836 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
836 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
3 ms |
492 KB |
Output is correct |
6 |
Correct |
4 ms |
548 KB |
Output is correct |
7 |
Correct |
3 ms |
560 KB |
Output is correct |
8 |
Correct |
5 ms |
560 KB |
Output is correct |
9 |
Correct |
35 ms |
688 KB |
Output is correct |
10 |
Correct |
67 ms |
688 KB |
Output is correct |
11 |
Correct |
3 ms |
688 KB |
Output is correct |
12 |
Correct |
4 ms |
688 KB |
Output is correct |
13 |
Correct |
3 ms |
688 KB |
Output is correct |
14 |
Correct |
4 ms |
688 KB |
Output is correct |
15 |
Correct |
4 ms |
688 KB |
Output is correct |
16 |
Correct |
3 ms |
688 KB |
Output is correct |
17 |
Correct |
3 ms |
688 KB |
Output is correct |
18 |
Correct |
3 ms |
688 KB |
Output is correct |
19 |
Correct |
3 ms |
688 KB |
Output is correct |
20 |
Correct |
3 ms |
688 KB |
Output is correct |
21 |
Correct |
3 ms |
688 KB |
Output is correct |
22 |
Correct |
3 ms |
724 KB |
Output is correct |
23 |
Correct |
3 ms |
724 KB |
Output is correct |
24 |
Correct |
3 ms |
724 KB |
Output is correct |
25 |
Correct |
3 ms |
724 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
724 KB |
Output is correct |
28 |
Correct |
3 ms |
724 KB |
Output is correct |
29 |
Correct |
3 ms |
724 KB |
Output is correct |
30 |
Correct |
3 ms |
724 KB |
Output is correct |
31 |
Correct |
4 ms |
724 KB |
Output is correct |
32 |
Correct |
3 ms |
724 KB |
Output is correct |
33 |
Correct |
3 ms |
724 KB |
Output is correct |
34 |
Correct |
4 ms |
724 KB |
Output is correct |
35 |
Correct |
2 ms |
724 KB |
Output is correct |
36 |
Runtime error |
4 ms |
748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
3 ms |
492 KB |
Output is correct |
6 |
Correct |
4 ms |
548 KB |
Output is correct |
7 |
Correct |
3 ms |
560 KB |
Output is correct |
8 |
Correct |
5 ms |
560 KB |
Output is correct |
9 |
Correct |
35 ms |
688 KB |
Output is correct |
10 |
Correct |
67 ms |
688 KB |
Output is correct |
11 |
Correct |
3 ms |
688 KB |
Output is correct |
12 |
Correct |
4 ms |
688 KB |
Output is correct |
13 |
Correct |
3 ms |
688 KB |
Output is correct |
14 |
Correct |
4 ms |
688 KB |
Output is correct |
15 |
Correct |
4 ms |
688 KB |
Output is correct |
16 |
Correct |
3 ms |
688 KB |
Output is correct |
17 |
Correct |
3 ms |
688 KB |
Output is correct |
18 |
Correct |
3 ms |
688 KB |
Output is correct |
19 |
Correct |
3 ms |
688 KB |
Output is correct |
20 |
Correct |
3 ms |
688 KB |
Output is correct |
21 |
Correct |
3 ms |
688 KB |
Output is correct |
22 |
Correct |
3 ms |
724 KB |
Output is correct |
23 |
Correct |
3 ms |
724 KB |
Output is correct |
24 |
Correct |
3 ms |
724 KB |
Output is correct |
25 |
Correct |
3 ms |
724 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
724 KB |
Output is correct |
28 |
Correct |
3 ms |
724 KB |
Output is correct |
29 |
Correct |
3 ms |
724 KB |
Output is correct |
30 |
Correct |
3 ms |
724 KB |
Output is correct |
31 |
Correct |
4 ms |
724 KB |
Output is correct |
32 |
Correct |
3 ms |
724 KB |
Output is correct |
33 |
Correct |
3 ms |
724 KB |
Output is correct |
34 |
Correct |
4 ms |
724 KB |
Output is correct |
35 |
Correct |
2 ms |
724 KB |
Output is correct |
36 |
Runtime error |
4 ms |
748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
37 |
Halted |
0 ms |
0 KB |
- |