Submission #97593

# Submission time Handle Problem Language Result Execution time Memory
97593 2019-02-17T12:06:47 Z dalgerok Pipes (CEOI15_pipes) C++14
20 / 100
1741 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 < pair < int, int > > g[N];

void dfs(int v, int pr = 0){
    tin[v] = fup[v] = ++timer;
    used[v] = true;
    for(auto it : g[v]){
        int to = it.first, ind = it.second;
        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(make_pair(y, i));
        g[y].push_back(make_pair(x, i));
    }
    for(int i = 1; i <= n; i++){
        if(!used[i]){
            dfs(i);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 3 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3328 KB Output is correct
2 Correct 7 ms 3132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 163 ms 18488 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 344 ms 24800 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 685 ms 44932 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 1145 ms 51632 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 1475 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 1611 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 1741 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 1637 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -