# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
563680 | 2022-05-17T23:53:33 Z | mjhmjh1104 | Pipes (CEOI15_pipes) | C++17 | 2059 ms | 65536 KB |
#include <cstdio> #include <vector> #include <algorithm> using namespace std; const int MAX = 100003; int v, e, cntDfs, dfsN[MAX]; vector<int> adj[MAX]; vector<pair<int, int>> r; int dfs(int x, int prev = -1) { int res = dfsN[x] = cntDfs++; for (auto &i: adj[x]) { if (i == prev) continue; if (dfsN[i]) res = min(res, dfsN[i]); else if (!dfsN[i]) { int t = dfs(i, x); res = min(res, t); if (t <= dfsN[x]) continue; r.push_back({ x, i }); } } return res; } int main() { scanf("%d%d", &v, &e); for (int i = 0; i < e; i++) { int a, b; scanf("%d%d", &a, &b); a--, b--; adj[a].push_back(b); adj[b].push_back(a); } for (int i = 0; i < v; i++) if (!dfsN[i]) dfs(i); for (auto &i: r) i = make_pair(min(i.first, i.second), max(i.first, i.second)); sort(r.begin(), r.end()); for (auto &i: r) printf("%d %d\n", i.first + 1, i.second + 1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Incorrect | 2 ms | 2644 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3156 KB | Output is correct |
2 | Incorrect | 5 ms | 3060 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 145 ms | 16216 KB | Output is correct |
2 | Correct | 141 ms | 15500 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 254 ms | 23856 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 438 ms | 41312 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 666 ms | 51772 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1125 ms | 65536 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1497 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1838 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2059 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |