# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
527253 |
2022-02-17T04:17:27 Z |
siewjh |
Pipes (CEOI15_pipes) |
C++17 |
|
248 ms |
16624 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
const int MAXN = 10'005;
vector<int> adjlist[MAXN];
int tvis[MAXN], lo[MAXN];
int cnt = 0;
void dfs(int x, int par) {
tvis[x] = lo[x] = cnt++;
bool vpar = 0;
for (auto nxt : adjlist[x]) {
if (nxt == par && !vpar) {
vpar = 1;
continue;
}
if (tvis[nxt] != INT_MAX) lo[x] = min(lo[x], tvis[nxt]);
else {
dfs(nxt, x);
lo[x] = min(lo[x], lo[nxt]);
if (lo[nxt] > tvis[x]) cout << nxt << ' ' << x << '\n';
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int nodes, edges; cin >> nodes >> edges;
for (int i = 0; i < edges; i++) {
int a, b; cin >> a >> b;
adjlist[a].push_back(b);
adjlist[b].push_back(a);
}
for (int i = 1; i <= nodes; i++) tvis[i] = INT_MAX;
for (int i = 1; i <= nodes; i++)
if (tvis[i] == INT_MAX)
dfs(i, -1);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1148 KB |
Output is correct |
2 |
Correct |
3 ms |
844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
8716 KB |
Output is correct |
2 |
Correct |
109 ms |
8060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
187 ms |
12320 KB |
Output is correct |
2 |
Runtime error |
248 ms |
16624 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
844 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |