# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
527269 |
2022-02-17T04:52:40 Z |
ecxx |
Pipes (CEOI15_pipes) |
C++17 |
|
2944 ms |
65540 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int* depth = new int[MAXN]{0};
int* low = new int[MAXN]{0};
int* pos = new int[MAXN];
int* edgelist;
void AP(int i, int d, int pa) {
depth[i] = d; low[i] = d;
int paedges = 0;
for (int k = pos[i]; k < pos[i+1]; k++) {
int ch = edgelist[k];
//cout << i << " " << ch << " " << pa << " p" << endl;
if (ch==pa) {
paedges++;
continue;
}
if (depth[ch] != -1) {
low[i] = min(low[i], depth[ch]);
} else {
AP(ch, d+1, i);
low[i] = min(low[i], low[ch]);
}
}
//cout << i << " " << pa << " " << paedges << endl;
if (pa==-1) return;
if (low[i] > depth[pa] && paedges == 1) {
cout << i+1 << " " << pa+1 << "\n";
}
}
int main() {
int N, M, a, b; cin >> N >> M;
pair<int,int>* EL;
EL = new pair<int,int>[2*M];
for (int i = 0; i < M; i++) {
cin >> a >> b; a--;b--;
EL[2*i] = {a,b};
EL[2*i+1] = {b,a};
}
sort(EL, EL+(2*M));
int curri = -1;
int q = 0;
edgelist = new int[2*M+5];
for (int k=0;k<2*M;k++) {
auto a = EL[k];
if (a.first != curri) {
pos[a.first] = q;
curri = a.first;
}
edgelist[q] = a.second;
q++;
}
pos[curri+1] = q;
delete[] EL;
for (int i = 0; i < N; i++) {
depth[i] = -1;
}
for (int i = 0; i < N; i++) {
if (depth[i] == -1) AP(i,0,-1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
972 KB |
Wrong number of edges |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1440 KB |
Mismatched edge |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
444 ms |
15036 KB |
Output is correct |
2 |
Correct |
371 ms |
14720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
793 ms |
24652 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1104 ms |
36288 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1372 ms |
43920 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2165 ms |
65540 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2944 ms |
65540 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
33 ms |
65540 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
34 ms |
65540 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |