Submission #527169

# Submission time Handle Problem Language Result Execution time Memory
527169 2022-02-17T03:10:07 Z ecxx Pipes (CEOI15_pipes) C++17
0 / 100
3773 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
    
int N;
const int MAXN = 100005;
int depth[MAXN] = {0};
int low[MAXN] = {0};
vector<int> AL[MAXN];
void AP(int i, int d, int pa) {
    depth[i] = d; low[i] = d;
    bool foundown = false;    
    for (int ch : AL[i]) {
        if (ch==pa) {
            if (!foundown) foundown = true;
            else low[i] = min(low[i], low[ch]);
        }
        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 (pa==-1) return;
    if (low[i] > depth[pa]) {
        cout << i+1 << " " << pa+1 << "\n";
    }
}
    
int main() {
    
    int N, M, a, b; cin >> N >> M;
    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++) {
        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 2636 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 3148 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 279 ms 10748 KB Output is correct
2 Incorrect 281 ms 10088 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 483 ms 14200 KB Output is correct
2 Runtime error 580 ms 18576 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 826 ms 25400 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1279 ms 31312 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1952 ms 53188 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2569 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3133 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3773 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -