Submission #527257

# Submission time Handle Problem Language Result Execution time Memory
527257 2022-02-17T04:23:28 Z ecxx Pipes (CEOI15_pipes) C++17
30 / 100
3544 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
    
int N;
const int MAXN = 100005;
uint16_t depth[MAXN] = {(uint16_t)0};
uint16_t low[MAXN] = {(uint16_t)0};
vector<int> AL[MAXN];
void AP(int i, uint16_t d, int pa) {
    depth[i] = d; low[i] = d;
    uint16_t paedges = 0;
    for (int ch : AL[i]) {
        if (ch==pa) {
            paedges++;
            continue;
        }
        if (depth[ch] != UINT16_MAX) {
            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] && paedges == 1) {
        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] = UINT16_MAX;
    }
    
    for (int i = 0; i < N; i++) {
        if (depth[i] == UINT16_MAX)  AP(i,(uint16_t)0,-1);
    }
    
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3148 KB Output is correct
2 Correct 8 ms 2892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 271 ms 10788 KB Output is correct
2 Correct 268 ms 10232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 485 ms 14168 KB Output is correct
2 Runtime error 589 ms 18476 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 844 ms 25200 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1357 ms 31096 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2097 ms 52808 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2666 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3326 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3544 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -