Submission #1084677

# Submission time Handle Problem Language Result Execution time Memory
1084677 2024-09-06T16:39:48 Z SulA Pipes (CEOI15_pipes) C++17
0 / 100
1090 ms 65540 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
using namespace std;
using namespace __gnu_pbds;
#define bitcount __builtin_popcountll
 
vector<int> adj[100000];
vector<pair<int,int>> bridges;
int dep[100000], low[100000];
 
void dfs(int u, int p) {
    low[u] = dep[u] = dep[p] + 1;
    for (int ch : adj[u]) {
        if (ch == p) continue;
        if (dep[ch] == 0) { // tree edge
            dfs(ch, u);
            low[u] = min(low[u], low[ch]);
        } else { // back edge
            low[u] = min(low[u], dep[ch]);
        }
    }
 
    if (low[u] == dep[u] && u != p) {
        bridges.emplace_back(u+1, p+1);
    }
}
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
 
    int n,m; cin >> n >> m;
    while (m--) {
        int a,b; cin >> a >> b;
        adj[--a].push_back(--b);
        adj[b].push_back(a);
    }
    for (int i = 0; i < n; i++) if (dep[i] == 0) {
        dfs(i, i);
    }
 
    cout << bridges.size() << "\n";
    for (auto [a, b] : bridges) {
        cout << a << " " << b << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2648 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3160 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 15308 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 147 ms 21848 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 248 ms 37428 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 362 ms 46084 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 615 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 765 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 996 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1090 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -