# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37476 | mohammad_kilani | Pipes (CEOI15_pipes) | C++14 | 1842 ms | 8696 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define oo 2000000000
const int N = 100010;
int n, m , cnt = 0 , dsu[N] , dsu2[N] , comp[N] , u , v , a ,b , depth[N];
bitset < N > bridge;
vector< pair<int,int> > g[N];
pair<int,int> parent[N];
inline int find(int u){ return (u == dsu[u] ? u : dsu[u] = find(dsu[u]));}
inline int find2(int u){ return (u == dsu2[u] ? u : dsu2[u] = find2(dsu2[u]));}
void DFS(int node,int prnt,int e,int d){
parent[node] = make_pair(prnt,e);
depth[node] = d;
if(bridge[e]) dsu2[node] = node; else dsu2[node] = find2(prnt);
for(int i=0;i<g[node].size();i++){
if(g[node][i].first != prnt) DFS(g[node][i].first,node,g[node][i].second,d+1);
}
}
int get(int node1,int node2){
if(node1 == node2) return find2(node1);
if(depth[node1] > depth[node2]){
bridge[parent[node1].second] = false;
return dsu2[node1] = dsu2[node2] = get(find2(parent[node1].first),node2);
}
bridge[parent[node2].second] = false;
return dsu2[node1] = dsu2[node2] = get(node1,find2(parent[node2].first));
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |