Submission #172717

# Submission time Handle Problem Language Result Execution time Memory
172717 2020-01-02T12:50:09 Z _demon_ Pipes (CEOI15_pipes) C++14
10 / 100
5000 ms 65536 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 500
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1000000007;//998244353;
const ll inf=1e18*4;
const ld pai=acos(-1);
int n,m,timer=1;
vi v[100009];
int disc[100009],low[100009],bridge[100009];
vpi ans;
map<pi,int>yes;
void dfs_bridges(int node,int p){
        disc[node]=low[node]=timer++;
        for(auto u:v[node]){
                if(u==p)continue;
                if(!disc[u]){
                        dfs_bridges(u,node);
                        if(low[u]>disc[node]){
                                if(!yes[{u,node}] && !yes[{node,u}]){
                                        yes[{u,node}]=1;
                                        ans.pb({node,u});
                                }
                        }
                        low[node]=min(low[node],low[u]);
                }
                else low[node]=min(low[node],disc[u]);
        }
}
int main(){
        cin>>n>>m;
        for(int i=0;i<m;i++){
                int a,b;cin>>a>>b,a--,b--;
                v[a].pb(b),v[b].pb(a);
        }
        dfs_bridges(0,0);
        for(auto u:ans)cout<<u.fi+1<<" "<<u.se+1<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Incorrect 4 ms 2684 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 3320 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 544 ms 11384 KB Output is correct
2 Correct 545 ms 10744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1053 ms 14672 KB Output is correct
2 Runtime error 1257 ms 30060 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 1831 ms 26052 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 2527 ms 32600 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 4054 ms 65536 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 Execution timed out 5057 ms 65536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5068 ms 65536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5052 ms 65536 KB Time limit exceeded
2 Halted 0 ms 0 KB -