#include <bits/stdc++.h>
#define ft first
#define sd second
using namespace std;
typedef pair<int, int> pii;
const int MAXN = 50 + 3;
int n, m, ans;
vector<int> g[MAXN];
bitset<MAXN> mark;
void dfs(int v) {
mark[v] = true;
for (auto i : g[v]) if (!mark[i]) dfs(i);
}
int main() {
cin >> n >> m;
if (n >= MAXN || m >= (MAXN << 1)) return 0;
ans = (n - 2) * (n - 1) * n;
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
g[--u].push_back(--v), g[v].push_back(u);
}
for (int i = 0; i < n; i++) {
set<pii> s;
for (int j = 0; j < n; j++) if (i != j) {
mark.reset();
mark[j] = true;
dfs(i);
mark[j] = false;
for (int a = 0; a < n; a++) if (!mark[a]) for (int b = a + 1; b < n; b++) if (!mark[b]) s.insert({a, b});
}
ans -= s.size() * 2;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
400 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
1 ms |
216 KB |
Output is correct |
33 |
Correct |
1 ms |
300 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
400 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
1 ms |
216 KB |
Output is correct |
33 |
Correct |
1 ms |
300 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
2 ms |
204 KB |
Output is correct |
36 |
Correct |
154 ms |
332 KB |
Output is correct |
37 |
Correct |
147 ms |
332 KB |
Output is correct |
38 |
Correct |
36 ms |
332 KB |
Output is correct |
39 |
Correct |
9 ms |
332 KB |
Output is correct |
40 |
Correct |
11 ms |
356 KB |
Output is correct |
41 |
Correct |
125 ms |
332 KB |
Output is correct |
42 |
Correct |
119 ms |
332 KB |
Output is correct |
43 |
Correct |
118 ms |
332 KB |
Output is correct |
44 |
Correct |
116 ms |
332 KB |
Output is correct |
45 |
Correct |
112 ms |
332 KB |
Output is correct |
46 |
Correct |
114 ms |
332 KB |
Output is correct |
47 |
Correct |
1 ms |
204 KB |
Output is correct |
48 |
Correct |
154 ms |
296 KB |
Output is correct |
49 |
Correct |
168 ms |
332 KB |
Output is correct |
50 |
Correct |
152 ms |
452 KB |
Output is correct |
51 |
Correct |
14 ms |
332 KB |
Output is correct |
52 |
Correct |
10 ms |
296 KB |
Output is correct |
53 |
Correct |
8 ms |
352 KB |
Output is correct |
54 |
Correct |
8 ms |
332 KB |
Output is correct |
55 |
Correct |
8 ms |
300 KB |
Output is correct |
56 |
Correct |
5 ms |
332 KB |
Output is correct |
57 |
Correct |
16 ms |
332 KB |
Output is correct |
58 |
Correct |
16 ms |
352 KB |
Output is correct |
59 |
Correct |
37 ms |
332 KB |
Output is correct |
60 |
Correct |
64 ms |
332 KB |
Output is correct |
61 |
Correct |
104 ms |
332 KB |
Output is correct |
62 |
Correct |
139 ms |
332 KB |
Output is correct |
63 |
Correct |
9 ms |
332 KB |
Output is correct |
64 |
Correct |
10 ms |
300 KB |
Output is correct |
65 |
Correct |
12 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
400 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
1 ms |
216 KB |
Output is correct |
33 |
Correct |
1 ms |
300 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
2 ms |
204 KB |
Output is correct |
36 |
Correct |
154 ms |
332 KB |
Output is correct |
37 |
Correct |
147 ms |
332 KB |
Output is correct |
38 |
Correct |
36 ms |
332 KB |
Output is correct |
39 |
Correct |
9 ms |
332 KB |
Output is correct |
40 |
Correct |
11 ms |
356 KB |
Output is correct |
41 |
Correct |
125 ms |
332 KB |
Output is correct |
42 |
Correct |
119 ms |
332 KB |
Output is correct |
43 |
Correct |
118 ms |
332 KB |
Output is correct |
44 |
Correct |
116 ms |
332 KB |
Output is correct |
45 |
Correct |
112 ms |
332 KB |
Output is correct |
46 |
Correct |
114 ms |
332 KB |
Output is correct |
47 |
Correct |
1 ms |
204 KB |
Output is correct |
48 |
Correct |
154 ms |
296 KB |
Output is correct |
49 |
Correct |
168 ms |
332 KB |
Output is correct |
50 |
Correct |
152 ms |
452 KB |
Output is correct |
51 |
Correct |
14 ms |
332 KB |
Output is correct |
52 |
Correct |
10 ms |
296 KB |
Output is correct |
53 |
Correct |
8 ms |
352 KB |
Output is correct |
54 |
Correct |
8 ms |
332 KB |
Output is correct |
55 |
Correct |
8 ms |
300 KB |
Output is correct |
56 |
Correct |
5 ms |
332 KB |
Output is correct |
57 |
Correct |
16 ms |
332 KB |
Output is correct |
58 |
Correct |
16 ms |
352 KB |
Output is correct |
59 |
Correct |
37 ms |
332 KB |
Output is correct |
60 |
Correct |
64 ms |
332 KB |
Output is correct |
61 |
Correct |
104 ms |
332 KB |
Output is correct |
62 |
Correct |
139 ms |
332 KB |
Output is correct |
63 |
Correct |
9 ms |
332 KB |
Output is correct |
64 |
Correct |
10 ms |
300 KB |
Output is correct |
65 |
Correct |
12 ms |
352 KB |
Output is correct |
66 |
Incorrect |
1 ms |
328 KB |
Output isn't correct |
67 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
400 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
1 ms |
216 KB |
Output is correct |
33 |
Correct |
1 ms |
300 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
2 ms |
204 KB |
Output is correct |
36 |
Correct |
154 ms |
332 KB |
Output is correct |
37 |
Correct |
147 ms |
332 KB |
Output is correct |
38 |
Correct |
36 ms |
332 KB |
Output is correct |
39 |
Correct |
9 ms |
332 KB |
Output is correct |
40 |
Correct |
11 ms |
356 KB |
Output is correct |
41 |
Correct |
125 ms |
332 KB |
Output is correct |
42 |
Correct |
119 ms |
332 KB |
Output is correct |
43 |
Correct |
118 ms |
332 KB |
Output is correct |
44 |
Correct |
116 ms |
332 KB |
Output is correct |
45 |
Correct |
112 ms |
332 KB |
Output is correct |
46 |
Correct |
114 ms |
332 KB |
Output is correct |
47 |
Correct |
1 ms |
204 KB |
Output is correct |
48 |
Correct |
154 ms |
296 KB |
Output is correct |
49 |
Correct |
168 ms |
332 KB |
Output is correct |
50 |
Correct |
152 ms |
452 KB |
Output is correct |
51 |
Correct |
14 ms |
332 KB |
Output is correct |
52 |
Correct |
10 ms |
296 KB |
Output is correct |
53 |
Correct |
8 ms |
352 KB |
Output is correct |
54 |
Correct |
8 ms |
332 KB |
Output is correct |
55 |
Correct |
8 ms |
300 KB |
Output is correct |
56 |
Correct |
5 ms |
332 KB |
Output is correct |
57 |
Correct |
16 ms |
332 KB |
Output is correct |
58 |
Correct |
16 ms |
352 KB |
Output is correct |
59 |
Correct |
37 ms |
332 KB |
Output is correct |
60 |
Correct |
64 ms |
332 KB |
Output is correct |
61 |
Correct |
104 ms |
332 KB |
Output is correct |
62 |
Correct |
139 ms |
332 KB |
Output is correct |
63 |
Correct |
9 ms |
332 KB |
Output is correct |
64 |
Correct |
10 ms |
300 KB |
Output is correct |
65 |
Correct |
12 ms |
352 KB |
Output is correct |
66 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
67 |
Halted |
0 ms |
0 KB |
- |