Submission #527134

# Submission time Handle Problem Language Result Execution time Memory
527134 2022-02-17T02:32:34 Z ecxx Pipes (CEOI15_pipes) C++17
0 / 100
6 ms 2128 KB
#include <bits/stdc++.h>
using namespace std;
uint16_t N;
vector<uint16_t> depth;
vector<uint16_t> low;
vector<vector<uint16_t> > AL;
void AP(uint16_t i, uint16_t d, uint16_t pa) {
    uint16_t cc = 0;
    depth[i] = d; low[i] = d;
    
    for (uint16_t ch : AL[i]) {
        if (ch==pa) continue;
        if (depth[ch] > -1) {
            low[i] = min(low[i], depth[ch]);
        } else {
            AP(ch, d+1, i);
            cc++;
            low[i] = min(low[i], low[ch]);
        }
    }

    if (low[i] == depth[i] && pa!=-1) {
        cout << i+1 << " " << pa+1 << "\n";
    }
}

int main() {

    uint16_t N, M, a, b; cin >> N >> M;
    depth.assign(N, -1);
    low.assign(N, 0);
    AL.assign(N, vector<uint16_t>());
    for (uint16_t i = 0; i < M; i++) {
        cin >> a >> b; a--;b--;
        AL[a].push_back(b); AL[b].push_back(a);
    }

    for (uint16_t i = 0; i < N; i++) {
        if (depth[i] == -1)  AP(i,0,-1);
    }

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 588 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 588 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 1740 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2092 KB Output is correct
2 Incorrect 2 ms 2088 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2124 KB Output is correct
2 Incorrect 1 ms 2104 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2124 KB Output is correct
2 Incorrect 1 ms 2104 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2096 KB Output is correct
2 Incorrect 1 ms 2128 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2092 KB Output is correct
2 Incorrect 2 ms 2100 KB Wrong number of edges
3 Halted 0 ms 0 KB -