Submission #527156

# Submission time Handle Problem Language Result Execution time Memory
527156 2022-02-17T02:53:43 Z ecxx Pipes (CEOI15_pipes) C++17
10 / 100
3826 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
    
int N;
vector<int> depth;
vector<int> low;
vector<vector<int> > AL;
void AP(int i, int d, int pa) {
    depth[i] = d; low[i] = d;
    
    for (int ch : AL[i]) {
        if (ch==pa) 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]);
        }
    }
    if (low[i] == depth[i] && pa!=-1) {
        cout << i+1 << " " << pa+1 << "\n";
    }
}
    
int main() {
    
    int N, M, a, b; cin >> N >> M;
    depth.assign(N, -1);
    low.assign(N, 0);
    AL.assign(N, vector<int>());
    for (int i = 0; i < M; i++) {
        cin >> a >> b; a--;b--;
        AL[a].push_back(b); AL[b].push_back(a);
    }
    
    for (int i = 0; i < N; i++) {
        if (depth[i] == -1)  AP(i,0,-1);
    }
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 960 KB Output is correct
2 Incorrect 9 ms 716 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 355 ms 10868 KB Output is correct
2 Correct 294 ms 10572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 547 ms 15336 KB Output is correct
2 Runtime error 611 ms 19948 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 991 ms 27668 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1233 ms 30092 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2052 ms 52196 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2716 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3418 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3826 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -