Submission #527170

# Submission time Handle Problem Language Result Execution time Memory
527170 2022-02-17T03:10:35 Z ecxx Pipes (CEOI15_pipes) C++17
0 / 100
3774 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], depth[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 315 ms 10772 KB Output is correct
2 Incorrect 323 ms 10052 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 508 ms 14212 KB Output is correct
2 Runtime error 562 ms 18544 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 845 ms 25268 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1299 ms 31280 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1952 ms 53108 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2658 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3342 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3774 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -