Submission #97596

# Submission time Handle Problem Language Result Execution time Memory
97596 2019-02-17T12:13:05 Z dalgerok Pipes (CEOI15_pipes) C++14
20 / 100
196 ms 16408 KB
#include<bits/stdc++.h>
using namespace std;


const int N = 5e3 + 1, M = 6e5 + 1;



int n, m;
int tin[N], fup[N], timer;
bitset < N > used;
bitset < M > usd;
vector < int > g[N], e[N];

void dfs(int v, int pr = 0){
    tin[v] = fup[v] = ++timer;
    used[v] = true;
    for(int i = 0; i < (int)g[v].size(); i++){
        int to = g[v][i], ind = e[v][i];
        if(ind == pr){
            continue;
        }
        if(!used[to]){
            dfs(to, ind);
            if(fup[to] > tin[v]){
                if(!usd[ind]){
                    usd[ind] = true;
                    cout << v << " " << to << "\n";
                }
            }
            fup[v] = min(fup[v], fup[to]);
        }
        else{
            fup[v] = min(fup[v], tin[to]);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        e[x].push_back(i);
        g[y].push_back(x);
        e[y].push_back(i);
    }
    for(int i = 1; i <= n; i++){
        if(!used[i]){
            dfs(i);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1324 KB Output is correct
2 Correct 6 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 196 ms 16408 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -