Submission #77033

#TimeUsernameProblemLanguageResultExecution timeMemory
77033farukkastamonudaBosses (BOI16_bosses)C++14
0 / 100
3 ms1288 KiB
#include <bits/stdc++.h> #define li 10005 #define lo long long using namespace std ; lo int n,x,y,vis[li],sub[li],par[li],vis2[li]; vector<lo int> v[li],vec[li]; queue<int> q; void dfs(int node,int ata){ if(vis2[node]==1) return ; vis2[node]=1; sub[node]=1; for(int i=0;i<(int)v[node].size();i++){ int go=v[node][i]; //if(go==par[node]) continue; if(vis2[go]==0){ 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++){ q.push(i); while(!q.empty()){ // printf("*"); int temp=q.front(); q.pop(); if(vis[temp]==1) continue; vis[temp]=1; for(int i=0;i<(int)v[temp].size();i++){ int go=v[temp][i]; if(vis[go]==0 && par[go]==0){ vec[temp].push_back(go); vec[go].push_back(temp); par[go]=temp; q.push(go); } } } //for(int j=1;j<=n;j++) printf("%d ",par[j]); // return 0; dfs(i,-1); cev=max(cev,sub[i]); for(int j=1;j<=n;j++) vec[j].clear(); memset(vis,0,sizeof(vis)); memset(vis2,0,sizeof(vis2)); } printf("%lld\n",cev); return 0; }

Compilation message (stderr)

bosses.cpp: In function 'int main()':
bosses.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
bosses.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&x);
         ~~~~~^~~~~~~~~~~
bosses.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%lld",&y);
             ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...