Submission #1084675

# Submission time Handle Problem Language Result Execution time Memory
1084675 2024-09-06T16:38:32 Z SulA Pipes (CEOI15_pipes) C++17
10 / 100
1087 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> adj[100000];
int dep[100000], low[100000];

void dfs(int v = 0, int p = 0) {
    low[v] = dep[v] = dep[p] + 1;
    for (int ch : adj[v]) {
        if (ch == p) continue;
        if (dep[ch] == 0) {
            dfs(ch, v);
            low[v] = min(low[v], low[ch]);
        } else {
            low[v] = min(low[v], dep[ch]);
        }
    }
    if (low[v] == dep[v] && v != p) {
        cout << v+1 << " " << p+1 << "\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    int n,m; cin >> n >> m;
    while (m--) {
        int u,v; cin >> u >> v;
        adj[--u].push_back(--v);
        adj[v].push_back(u);
    }
    for (int i = 0; i < n; i++) if (dep[i] == 0) dfs(i, i);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Incorrect 1 ms 2812 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3164 KB Output is correct
2 Incorrect 4 ms 3164 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 16208 KB Output is correct
2 Correct 78 ms 15628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 134 ms 23888 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 245 ms 41172 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 351 ms 51092 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 626 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 795 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 911 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1087 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -