답안 #97595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97595 2019-02-17T12:11:54 Z dalgerok Pipes (CEOI15_pipes) C++14
20 / 100
2677 ms 65536 KB
#include<bits/stdc++.h>
using namespace std;


const int N = 1e5 + 1, M = 6e6 + 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);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 4992 KB Output is correct
2 Correct 5 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 5936 KB Output is correct
2 Correct 10 ms 5664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 206 ms 20860 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 593 ms 27288 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1162 ms 47384 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1762 ms 54092 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2252 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2488 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2677 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2541 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -