# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77031 | farukkastamonuda | Bosses (BOI16_bosses) | C++14 | 2 ms | 1020 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 li 10005
#define lo long long
using namespace std ;
lo int n,x,y,vis[li],sub[li];
vector<lo int> v[li];
void dfs(lo int node,lo int ata){
vis[node]=1;
sub[node]=1;
for(int i=0;i<(int)v[node].size();i++){
lo int go=v[node][i];
if(vis[go]==0 && go!=ata){
dfs(go,node);
sub[node]+=sub[go];
}
}
sub[node]+=1;
}
int main(){
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&x);
for(int j=1;j<=x;j++){
scanf("%lld",&y);
v[y].push_back(i);
}
}
lo int cev=0;
for(int i=1;i<=n;i++){
dfs(i,i);
cev=max(cev,sub[i]);
memset(vis,0,sizeof(vis));
memset(sub,0,sizeof(sub));
}
printf("%lld\n",cev);
return 0;
}
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... |