Submission #99651

# Submission time Handle Problem Language Result Execution time Memory
99651 2019-03-06T04:15:33 Z adlet Pipes (CEOI15_pipes) C++17
10 / 100
5000 ms 65236 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define ios ios_base::sync_with_stdio(0), cin.tie(0)

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int INF = 1e9;
const double PI = acos(-1.0);

int n, m, cnt, timer, fup[N], used[N], tin[N];

vector < int > g[N];

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]) {
            dfs(to, v);
            fup[v] = min(fup[v], fup[to]);
            if (fup[to] > tin[v])
                cout << v << " " << to << "\n";
        } else
            fup[v] = min(fup[v], tin[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);
        }
    }
}
/**
clock() / (double)CLOCKS_PER_SEC < 1.9

*/
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2688 KB Output is correct
2 Incorrect 4 ms 2688 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 12 ms 3072 KB Output is correct
2 Incorrect 12 ms 2944 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 352 ms 10612 KB Output is correct
2 Correct 358 ms 10180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 763 ms 14108 KB Output is correct
2 Runtime error 851 ms 18660 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 1359 ms 24612 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 1971 ms 28892 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 2908 ms 50440 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 4062 ms 63736 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 4997 ms 65236 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 Execution timed out 5070 ms 57944 KB Time limit exceeded
2 Halted 0 ms 0 KB -