Submission #771801

# Submission time Handle Problem Language Result Execution time Memory
771801 2023-07-03T09:34:30 Z CyberCow Duathlon (APIO18_duathlon) C++17
5 / 100
1000 ms 19148 KB
//#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)
{
    if (ans == 1)
        return;
    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);
    }
    vector<int> c;
    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)
                {
                    c = color;
                    ans = 0;
                    //cout << i << ' ' << j << ' ' << h << '\n';
                    Dfs(i, j, h, c);
                    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 7364 KB Output is correct
3 Correct 3 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 4 ms 7252 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 5 ms 7252 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
14 Correct 4 ms 7252 KB Output is correct
15 Correct 4 ms 7372 KB Output is correct
16 Correct 4 ms 7252 KB Output is correct
17 Correct 4 ms 7372 KB Output is correct
18 Correct 4 ms 7252 KB Output is correct
19 Correct 3 ms 7252 KB Output is correct
20 Correct 4 ms 7372 KB Output is correct
21 Correct 4 ms 7252 KB Output is correct
22 Correct 5 ms 7372 KB Output is correct
23 Correct 3 ms 7252 KB Output is correct
24 Correct 4 ms 7252 KB Output is correct
25 Correct 5 ms 7252 KB Output is correct
26 Correct 4 ms 7252 KB Output is correct
27 Correct 4 ms 7368 KB Output is correct
28 Correct 4 ms 7252 KB Output is correct
29 Correct 4 ms 7368 KB Output is correct
30 Correct 4 ms 7252 KB Output is correct
31 Correct 3 ms 7252 KB Output is correct
32 Correct 3 ms 7372 KB Output is correct
33 Correct 3 ms 7372 KB Output is correct
34 Correct 4 ms 7252 KB Output is correct
35 Correct 4 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7252 KB Output is correct
2 Correct 3 ms 7364 KB Output is correct
3 Correct 3 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 4 ms 7252 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 5 ms 7252 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
14 Correct 4 ms 7252 KB Output is correct
15 Correct 4 ms 7372 KB Output is correct
16 Correct 4 ms 7252 KB Output is correct
17 Correct 4 ms 7372 KB Output is correct
18 Correct 4 ms 7252 KB Output is correct
19 Correct 3 ms 7252 KB Output is correct
20 Correct 4 ms 7372 KB Output is correct
21 Correct 4 ms 7252 KB Output is correct
22 Correct 5 ms 7372 KB Output is correct
23 Correct 3 ms 7252 KB Output is correct
24 Correct 4 ms 7252 KB Output is correct
25 Correct 5 ms 7252 KB Output is correct
26 Correct 4 ms 7252 KB Output is correct
27 Correct 4 ms 7368 KB Output is correct
28 Correct 4 ms 7252 KB Output is correct
29 Correct 4 ms 7368 KB Output is correct
30 Correct 4 ms 7252 KB Output is correct
31 Correct 3 ms 7252 KB Output is correct
32 Correct 3 ms 7372 KB Output is correct
33 Correct 3 ms 7372 KB Output is correct
34 Correct 4 ms 7252 KB Output is correct
35 Correct 4 ms 7252 KB Output is correct
36 Correct 5 ms 7252 KB Output is correct
37 Correct 6 ms 7252 KB Output is correct
38 Correct 652 ms 7352 KB Output is correct
39 Execution timed out 1082 ms 7252 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 19148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 7380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 11448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 7380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 11496 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 7364 KB Output is correct
3 Correct 3 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 4 ms 7252 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 5 ms 7252 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
14 Correct 4 ms 7252 KB Output is correct
15 Correct 4 ms 7372 KB Output is correct
16 Correct 4 ms 7252 KB Output is correct
17 Correct 4 ms 7372 KB Output is correct
18 Correct 4 ms 7252 KB Output is correct
19 Correct 3 ms 7252 KB Output is correct
20 Correct 4 ms 7372 KB Output is correct
21 Correct 4 ms 7252 KB Output is correct
22 Correct 5 ms 7372 KB Output is correct
23 Correct 3 ms 7252 KB Output is correct
24 Correct 4 ms 7252 KB Output is correct
25 Correct 5 ms 7252 KB Output is correct
26 Correct 4 ms 7252 KB Output is correct
27 Correct 4 ms 7368 KB Output is correct
28 Correct 4 ms 7252 KB Output is correct
29 Correct 4 ms 7368 KB Output is correct
30 Correct 4 ms 7252 KB Output is correct
31 Correct 3 ms 7252 KB Output is correct
32 Correct 3 ms 7372 KB Output is correct
33 Correct 3 ms 7372 KB Output is correct
34 Correct 4 ms 7252 KB Output is correct
35 Correct 4 ms 7252 KB Output is correct
36 Correct 5 ms 7252 KB Output is correct
37 Correct 6 ms 7252 KB Output is correct
38 Correct 652 ms 7352 KB Output is correct
39 Execution timed out 1082 ms 7252 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7252 KB Output is correct
2 Correct 3 ms 7364 KB Output is correct
3 Correct 3 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 4 ms 7252 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 5 ms 7252 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
14 Correct 4 ms 7252 KB Output is correct
15 Correct 4 ms 7372 KB Output is correct
16 Correct 4 ms 7252 KB Output is correct
17 Correct 4 ms 7372 KB Output is correct
18 Correct 4 ms 7252 KB Output is correct
19 Correct 3 ms 7252 KB Output is correct
20 Correct 4 ms 7372 KB Output is correct
21 Correct 4 ms 7252 KB Output is correct
22 Correct 5 ms 7372 KB Output is correct
23 Correct 3 ms 7252 KB Output is correct
24 Correct 4 ms 7252 KB Output is correct
25 Correct 5 ms 7252 KB Output is correct
26 Correct 4 ms 7252 KB Output is correct
27 Correct 4 ms 7368 KB Output is correct
28 Correct 4 ms 7252 KB Output is correct
29 Correct 4 ms 7368 KB Output is correct
30 Correct 4 ms 7252 KB Output is correct
31 Correct 3 ms 7252 KB Output is correct
32 Correct 3 ms 7372 KB Output is correct
33 Correct 3 ms 7372 KB Output is correct
34 Correct 4 ms 7252 KB Output is correct
35 Correct 4 ms 7252 KB Output is correct
36 Correct 5 ms 7252 KB Output is correct
37 Correct 6 ms 7252 KB Output is correct
38 Correct 652 ms 7352 KB Output is correct
39 Execution timed out 1082 ms 7252 KB Time limit exceeded
40 Halted 0 ms 0 KB -