# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
781220 |
2023-07-13T00:00:32 Z |
NK_ |
Pipes (CEOI15_pipes) |
C++17 |
|
490 ms |
65536 KB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define f first
#define s second
#define mp make_pair
#define pb push_back
using pi = pair<int, int>;
template<class T> using V = vector<T>;
const int nax = 1e5+5;
pi stk[nax];
int disc[nax], crit[nax], cur, ti;
V<pi> adj[nax];
void dfs(int u, int x) {
disc[u] = ++ti;
for(auto e : adj[u]) {
int v, i; tie(v, i) = e;
if (i == x) continue;
if (disc[v] == -1) {
stk[cur++] = mp(u, i);
dfs(v, i);
} else {
int up = disc[v];
crit[i] = 0;
// cout << v << " " << up << endl;
while(cur > 0 && disc[stk[cur - 1].f] >= up) crit[stk[--cur].s] = 0;
}
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cur = ti = 0;
for(int i = 0; i < nax; i++) {
stk[i] = mp(-1, -1);
disc[i] = -1;
crit[i] = 1;
adj[i] = {};
}
int N, M; cin >> N >> M;
V<pi> E(M);
for(int e = 0; e < M; e++) {
int u, v; cin >> u >> v; --u, --v;
E[e] = mp(u + 1, v + 1);
adj[u].pb(mp(v, e));
adj[v].pb(mp(u, e));
}
for(int i = 0; i < N; i++) if (disc[i] == -1) dfs(i, -1);
for(int i = 0; i < M; i++) if (crit[i]) {
cout << E[i].f << " " << E[i].s << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4180 KB |
Wrong number of edges |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4948 KB |
Wrong number of edges |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
113 ms |
55248 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
205 ms |
65536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
357 ms |
65536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
490 ms |
65536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
371 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
414 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
259 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
171 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |