Submission #17589

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
175892016-01-01 02:08:50cometShymbulak (IZhO14_shymbulak)C++98
100 / 100
115 ms22144 KiB
#include<iostream>
#include<vector>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
vector<int> path[222222];
vector<int> cycle;
int n,chk[222222],T,N;
ll Max,cnt,a[222222],b[222222],CNT[422222];
bool isCycle[222222];
deque<ll> index,value;
pp dfs(int v,int p){
int u,i,z0=0,cnt0=1;
pp t;
for(i=0;i<path[v].size();i++){
u=path[v][i];
if(u==p||isCycle[u])continue;
t=dfs(u,v);
if(z0+t.first+1>Max)Max=z0+t.first+1,cnt=(1ll*cnt0)*t.second;
else if(z0+t.first+1==Max)cnt+=(1ll*cnt0)*t.second;
if(z0<t.first)z0=t.first,cnt0=t.second;
else if(z0==t.first)cnt0+=t.second;
}
return pp(z0+1,cnt0);
}
int find_cycle(int v,int p){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...