Submission #99656

# Submission time Handle Problem Language Result Execution time Memory
99656 2019-03-06T04:31:44 Z adlet Pipes (CEOI15_pipes) C++17
10 / 100
5000 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, cnt, timer, fup[N], used[N], tin[N];
vector < int > g[N];
set < pair < int, int > > ans;
inline void dfs(int v, int p = -1) {
    used[v] = 1;
    tin[v] = ++timer;
    fup[v] = timer;
    for (int to : g[v]) {
        if (to == p)
            continue;
        if (used[to])
            fup[v] = min(fup[v], tin[to]);
        else {
            dfs(to, v);
            fup[v] = min(fup[v], fup[to]);
            if (fup[to] > tin[v])
                ans.insert({v, to});
        }
    }
}

int main() {
    cin >> n >> m;
    for (int i = 1; i <= m; ++i) {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    for (int i = 1; i <= n; ++i) {
        if (!used[i]) {
            dfs(i);
        }
    }
    for (auto i : ans)
        cout << i.first << " " << i.second << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Incorrect 4 ms 2688 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 11 ms 3176 KB Output is correct
2 Incorrect 11 ms 2944 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 353 ms 10748 KB Output is correct
2 Correct 354 ms 10152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 726 ms 14012 KB Output is correct
2 Runtime error 837 ms 18632 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 1309 ms 24812 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1914 ms 29740 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3272 ms 51096 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3930 ms 64708 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4731 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5064 ms 61236 KB Time limit exceeded
2 Halted 0 ms 0 KB -