Submission #656911

# Submission time Handle Problem Language Result Execution time Memory
656911 2022-11-08T13:36:59 Z benjaminkleyn Pipes (CEOI15_pipes) C++17
20 / 100
922 ms 65536 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int max_n = 10001;

int n, m, ti[max_n] = {0}, lo[max_n], timer = 0;
unordered_map<int,int> g[max_n];

void dfs(int u, int p = -1)
{
    ti[u] = lo[u] = ++timer;
    for (auto [v, cnt] : g[u])
        if (v != p)
        {
            if (ti[v])
                lo[u] = min(lo[u], ti[v]);
            else
            {
                dfs(v, u);
                lo[u] = min(lo[u], lo[v]);

                if (lo[v] > ti[u] && cnt < 2)
                    cout << u << ' ' << v << '\n';
            }
        }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m;
    for (int i = 0, a ,b; i < m; i++)
    {
        cin >> a >> b;
        g[a][b]++;
        g[b][a]++;
    }

    for (int i = 1; i <= n; i++)
        if (!ti[i])
            dfs(i);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2384 KB Output is correct
2 Correct 6 ms 2004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 922 ms 52072 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 800 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1528 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -