답안 #172741

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172741 2020-01-02T13:51:28 Z _demon_ Pipes (CEOI15_pipes) C++14
10 / 100
1962 ms 65540 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,num;
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}] && num[{u,node}]<=1){
                                        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);
                num[{a,b}]++;
                num[{b,a}]++;
        }
        dfs_bridges(0,0);
        for(auto u:ans)cout<<u.fi+1<<" "<<u.se+1<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 4856 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1634 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1718 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1734 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 1776 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 1808 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1884 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 1962 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 1779 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -