Submission #97594

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


const int N = 1e5 + 1, M = 1e6 + 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 6 ms 4992 KB Output is correct
2 Correct 5 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 5860 KB Output is correct
2 Correct 11 ms 5632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 212 ms 20868 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 465 ms 27196 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 1030 ms 47348 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 1807 ms 54216 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 2296 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2669 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2654 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2527 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -