//#include <bits/stdc++.h>
#include <random>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#define fr first
#define sc second
#define ad push_back
using namespace std;
using ll = long long;
mt19937 rnd(348502);
const int N = 300005;
vector<int> v[N];
int ans = 0;
void Dfs(int g, int x, int y, vector<int> color)
{
color[g] = 1;
for (auto to : v[g])
{
if (color[x] == 0 && to == y)
continue;
if (color[to] == 0)
{
color[to] = 1;
Dfs(to, x, y, color);
color[to] = 0;
}
}
if (color[y] == 1)
ans = 1;
}
void solve()
{
int n, i, j, x, y, m;
cin >> n >> m;
for ( i = 0; i < m; i++)
{
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
vector<int> color;
for ( i = 0; i <= n; i++)
{
color.push_back(0);
}
int anss = 0;
for ( i = 1; i <= n; i++)
{
for ( j = 1; j <= n; j++)
{
for (int h= 1; h <= n; h++)
{
if (j != i && h != j && i != h)
{
ans = 0;
//cout << i << ' ' << j << ' ' << h << '\n';
Dfs(i, j, h, color);
if (ans == 1)
anss++;
}
}
}
}
cout << anss;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7252 KB |
Output is correct |
2 |
Correct |
3 ms |
7252 KB |
Output is correct |
3 |
Correct |
4 ms |
7252 KB |
Output is correct |
4 |
Correct |
3 ms |
7252 KB |
Output is correct |
5 |
Correct |
3 ms |
7252 KB |
Output is correct |
6 |
Correct |
3 ms |
7252 KB |
Output is correct |
7 |
Correct |
3 ms |
7252 KB |
Output is correct |
8 |
Correct |
14 ms |
7372 KB |
Output is correct |
9 |
Correct |
410 ms |
7252 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
7252 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7252 KB |
Output is correct |
2 |
Correct |
3 ms |
7252 KB |
Output is correct |
3 |
Correct |
4 ms |
7252 KB |
Output is correct |
4 |
Correct |
3 ms |
7252 KB |
Output is correct |
5 |
Correct |
3 ms |
7252 KB |
Output is correct |
6 |
Correct |
3 ms |
7252 KB |
Output is correct |
7 |
Correct |
3 ms |
7252 KB |
Output is correct |
8 |
Correct |
14 ms |
7372 KB |
Output is correct |
9 |
Correct |
410 ms |
7252 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
7252 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
460 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
7380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
23800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
7508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
23252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7252 KB |
Output is correct |
2 |
Correct |
3 ms |
7252 KB |
Output is correct |
3 |
Correct |
4 ms |
7252 KB |
Output is correct |
4 |
Correct |
3 ms |
7252 KB |
Output is correct |
5 |
Correct |
3 ms |
7252 KB |
Output is correct |
6 |
Correct |
3 ms |
7252 KB |
Output is correct |
7 |
Correct |
3 ms |
7252 KB |
Output is correct |
8 |
Correct |
14 ms |
7372 KB |
Output is correct |
9 |
Correct |
410 ms |
7252 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
7252 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7252 KB |
Output is correct |
2 |
Correct |
3 ms |
7252 KB |
Output is correct |
3 |
Correct |
4 ms |
7252 KB |
Output is correct |
4 |
Correct |
3 ms |
7252 KB |
Output is correct |
5 |
Correct |
3 ms |
7252 KB |
Output is correct |
6 |
Correct |
3 ms |
7252 KB |
Output is correct |
7 |
Correct |
3 ms |
7252 KB |
Output is correct |
8 |
Correct |
14 ms |
7372 KB |
Output is correct |
9 |
Correct |
410 ms |
7252 KB |
Output is correct |
10 |
Execution timed out |
1089 ms |
7252 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |