# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83600 | Bodo171 | Pipes (BOI13_pipes) | C++14 | 97 ms | 49500 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 <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int nmax=100005;
vector< pair<int,int> > v[nmax];
pair<int,int> cyc[nmax];
int rep[nmax],wh[nmax],mu[nmax],viz[nmax],ans[nmax],vreau[nmax],am[nmax];
int n,nr,m,i,j,sz,x,y,act,a,b;
void solve(int x)
{
int nod=0;
viz[x]=1;
for(int i=0;i<v[x].size();i++)
if(!viz[v[x][i].first])
{
nod=v[x][i].first;
solve(nod);
ans[v[x][i].second]=vreau[nod]-am[nod];
am[x]+=(vreau[nod]-am[nod]);
}
}
void dfs(int x)
{
wh[x]=nr;rep[++nr]=x;
for(int i=0;i<v[x].size();i++)
{
mu[nr]=v[x][i].second;
if(!wh[v[x][i].first]) dfs(v[x][i].first);
else
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |