Submission #550200

# Submission time Handle Problem Language Result Execution time Memory
550200 2022-04-17T14:29:36 Z leaked Pipes (CEOI15_pipes) C++17
10 / 100
1882 ms 65536 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const int N=1e5+1;
vec<int> g[N];
int fup[N],in[N],tt=2;
void dfs(int v,int p){
    fup[v]=in[v]=tt++;
    for(auto &z : g[v]){
        if(z==p) continue;
        if(in[z]) umin(fup[v],in[z]);
        else{
            dfs(z,v);
            umin(fup[v],fup[z]);
            if(fup[z]>in[v]){
                cout<<v+1<<' '<<z+1<<'\n';
            }
        }
    }
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m;
    int v,u;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>v>>u;--v;--u;
        g[v].pb(u);g[u].pb(v);
    }
    for(int i=0;i<n;i++){
        if(!in[i])
            dfs(i,i);
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2644 KB Output is correct
2 Incorrect 2 ms 2644 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3284 KB Output is correct
2 Incorrect 4 ms 3028 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 109 ms 11080 KB Output is correct
2 Correct 108 ms 10524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 14564 KB Output is correct
2 Runtime error 237 ms 18808 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 384 ms 25468 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 584 ms 31764 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1307 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1427 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1765 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1882 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -