#include <bits/stdc++.h>
using ll = long long;
#define int ll
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
using namespace std;
const int N = 3e3;
int n;
int m;
vector<int> g[N];
int used[N];
int timer = 0;
int answer = 0;
void dfs(int v, int d) {
if (d > 1) {
answer += d - 1;
}
used[v] = timer;
for (int u : g[v]) {
if (used[u] < timer) {
dfs(u, d + 1);
}
}
}
signed main() {
#ifdef LC
assert(freopen("input.txt", "r", stdin));
#endif // LC
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int v, u, i = 0; i < m; ++i) {
cin >> v >> u;
--v;
--u;
g[v].push_back(u);
g[u].push_back(v);
}
for (int i = 0; i < n; ++i) {
++timer;
dfs(i, 0);
}
cout << answer << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
14 ms |
512 KB |
Output is correct |
3 |
Correct |
15 ms |
632 KB |
Output is correct |
4 |
Correct |
20 ms |
512 KB |
Output is correct |
5 |
Correct |
18 ms |
512 KB |
Output is correct |
6 |
Correct |
15 ms |
512 KB |
Output is correct |
7 |
Correct |
18 ms |
512 KB |
Output is correct |
8 |
Correct |
16 ms |
512 KB |
Output is correct |
9 |
Correct |
17 ms |
512 KB |
Output is correct |
10 |
Correct |
12 ms |
512 KB |
Output is correct |
11 |
Correct |
9 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
512 KB |
Output is correct |
13 |
Correct |
3 ms |
512 KB |
Output is correct |
14 |
Correct |
1 ms |
512 KB |
Output is correct |
15 |
Correct |
1 ms |
512 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
512 KB |
Output is correct |
18 |
Correct |
10 ms |
512 KB |
Output is correct |
19 |
Correct |
7 ms |
512 KB |
Output is correct |
20 |
Correct |
7 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
13 ms |
512 KB |
Output is correct |
3 |
Incorrect |
15 ms |
512 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |