# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477111 | Jasiekstrz | Pipes (BOI13_pipes) | C++17 | 209 ms | 23092 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>
#define fi first
#define se second
using namespace std;
const int N=1e5,M=5e5;
int val[N+10];
vector<pair<int,int>> e[N+10];
bool vis[N+10];
bool on_c[N+10];
vector<int> stck;
int ans[M+10];
int pref[N+10];
int ss=0;
void on_cycle(int x)
{
vis[x]=true;
stck.push_back(x);
for(auto v:e[x])
{
if(!vis[v.fi])
on_cycle(v.fi);
else if(!on_c[x] && stck.size()>=2 && stck[stck.size()-2]!=v.fi)
{
for(size_t i=stck.size()-1;stck[i]!=v.fi;i--)
on_c[stck[i]]=true;
on_c[v.fi]=true;
}
}
stck.pop_back();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |