# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77030 | farukkastamonuda | Bosses (BOI16_bosses) | C++14 | 3 ms | 544 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 5005
using namespace std ;
int n,x,y,vis[li],sub[li];
vector<int> v[li];
void dfs(int node,int ata){
vis[node]=1;
sub[node]=1;
for(int i=0;i<(int)v[node].size();i++){
int go=v[node][i];
if(vis[go]==0 && go!=ata){
dfs(go,node);
sub[node]+=sub[go];
}
}
sub[node]+=1;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&x);
for(int j=1;j<=x;j++){
scanf("%d",&y);
v[y].push_back(i);
}
}
int cev=0;
for(int i=1;i<=n;i++){
dfs(i,i);
cev=max(cev,sub[i]);
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... |