Submission #477111

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4771112021-09-30 14:49:45JasiekstrzPipes (BOI13_pipes)C++17
100 / 100
209 ms23092 KiB
#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();
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...