# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959011 | 2024-04-07T11:22:49 Z | Cyber_Wolf | Pipes (CEOI15_pipes) | C++17 | 1644 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; #define lg int #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const lg N = 1e5+5; vector<lg> adj[N]; lg n,m, tin[N], tmp, id; int dfs(lg src, lg par = -1) { int low; tin[src] = low = ++tmp; int idx = 0; for(auto it : adj[src]) { if(it == par) { idx++; continue; } if(tin[it]) { low = min(low, tin[it]); idx++; continue; } int low_it = dfs(it, src); low = min(low, low_it); if(idx && adj[src][idx-1] == it) { idx++; continue; } if(idx+1 < adj[src].size() && adj[src][idx+1] == it) { idx++; continue; } if(low_it > tin[src]) { cout << src << ' ' << it << endl; } idx++; } return low; } int main() { fastio; cin >> n >> m; for(int i = 0; i < m; i++) { lg u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } for(int i = 1; i <= n; i++) sort(adj[i].begin(), adj[i].end()); for(int i = 1; i <= n; i++) { if(!tin[i]) dfs(i); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2908 KB | Output is correct |
2 | Correct | 1 ms | 2908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3464 KB | Output is correct |
2 | Correct | 4 ms | 3164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 149 ms | 14068 KB | Output is correct |
2 | Correct | 121 ms | 13800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 216 ms | 20056 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 392 ms | 34776 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 550 ms | 43340 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 901 ms | 65536 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1216 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1644 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1346 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |