Submission #695211

#TimeUsernameProblemLanguageResultExecution timeMemory
695211Ahmed_SolymanBosses (BOI16_bosses)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; vector<int>adj[5005]; vector<long long>s(5005); vector<bool>vis(5005); void dfs(int n){ vis[n]=1; ll u=0; for(auto i:adj[n]){ if(!vis[i]){ vis[i]=1; dfs(i); u+=s[i]; } } s[n]=u; } int main(){ int n;cin>>n; for(int i=1;i<=n;i++){ int k;cin>>k; for(int j=0;j<k;j++){ int x;cin>>x; adj[x].push_back(i); } } long long ans=4e18; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ vis[j]=0; s[j]=0; } dfs(i); long long sum=0; for(int j=1;j<=n;j++){ sum+=s[j]; if(!vis[j]){ sum=1e18; } } ans=min(ans,sum); } cout<<ans<<endl; }

Compilation message (stderr)

bosses.cpp: In function 'void dfs(int)':
bosses.cpp:8:2: error: 'll' was not declared in this scope
    8 |  ll u=0;
      |  ^~
bosses.cpp:13:4: error: 'u' was not declared in this scope
   13 |    u+=s[i];
      |    ^
bosses.cpp:16:7: error: 'u' was not declared in this scope
   16 |  s[n]=u;
      |       ^