Submission #83092

#TimeUsernameProblemLanguageResultExecution timeMemory
83092osmanorhanBosses (BOI16_bosses)C++17
0 / 100
255 ms263168 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <cmath> #include <climits> #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <cassert> #include <vector> #define all(x) x.begin() , x.end() #define fi first #define se second #define pb push_back #define umax( x , y ) x = max( x , (y) ) #define umin( x , y ) x = min( x , (y) ) #define null NULL #define ort (b+s)/2 using namespace std; typedef long long Lint; typedef long double db; typedef pair<int,int> ii; typedef pair<int,ii> iii; typedef pair<db,db> dd; typedef pair<int,string> is; const int maxn = 1500020; const int maxx = 1500000; const int MOd = 998244353; int a; int dad[maxn], cur; vector<int> w[maxn]; int dfs( int n ) { for(int i=0;i<w[n].size();i++) if( dad[ w[n][i] ] ) dad[ w[n][i] ] = n; int ret = 1; for(int i=0;i<w[n].size();i++) ret += dfs( w[n][i] ); cur += ret; return ret; } int main( ) { scanf("%d",&a); for(int i=1,k;i<=a;i++) { scanf("%d",&k); for(int j=0,t;j<k;j++) { scanf("%d",&t); w[t].pb( i ); } } int ans = 0; for(int i=1;i<=a;i++) { memset( dad, 0, sizeof( dad ) ); cur = 0;dfs( i ); umax( ans, cur ); } cout << ans << endl; return 0; }

Compilation message (stderr)

bosses.cpp: In function 'int dfs(int)':
bosses.cpp:42:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<w[n].size();i++)
              ~^~~~~~~~~~~~
bosses.cpp:45:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<w[n].size();i++)
              ~^~~~~~~~~~~~
bosses.cpp: In function 'int main()':
bosses.cpp:53:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&a);
  ~~~~~^~~~~~~~~
bosses.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&k);
   ~~~~~^~~~~~~~~
bosses.cpp:57:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&t);
    ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...