Submission #1152777

#TimeUsernameProblemLanguageResultExecution timeMemory
1152777sodbayrBosses (BOI16_bosses)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; const ll N = 5000 + 100, M = 4096 + 10; vector<ll> q[5005],lt[5005]; ll w[5005],sm; ll dfs(ll v){ ll r=0; for(auto u : lt[v]){ r+=dfs(u); } sm=sm+r+1; return r+1; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,k,s,sum=INT_MAX; cin>>n; for(ll i=1;i<=n;i++){ cin>>k; for(ll j=1;j<=k;j++){ cin>>x; q[x].pb(i); } } for(ll i=1;i<=n;i++){ for(ll j=1;j<=n;j++){ w[j]=0; lt[j].clear(); } ll c=1; w[i]=1; queue<ll> g; g.push(i); while(g.size()!=0){ ll v=g.front(); g.pop(); for(auto u : q[v]){ if(w[u]) continue; c++; w[u]=1; lt[v].pb(u); g.push(u); } } if(c==n){ sm=0; dfs(i); sum=min(sum,sm); } } cout<<sum; }

Compilation message (stderr)

bosses.cpp:4:7: error: 'll' does not name a type
    4 | const ll N = 5000 + 100, M = 4096 + 10;
      |       ^~
bosses.cpp:5:16: error: 'll' was not declared in this scope
    5 |         vector<ll> q[5005],lt[5005];
      |                ^~
bosses.cpp:5:18: error: template argument 1 is invalid
    5 |         vector<ll> q[5005],lt[5005];
      |                  ^
bosses.cpp:5:18: error: template argument 2 is invalid
bosses.cpp:6:9: error: 'll' does not name a type
    6 |         ll w[5005],sm;
      |         ^~
bosses.cpp:7:1: error: 'll' does not name a type
    7 | ll dfs(ll v){
      | ^~
bosses.cpp: In function 'int main()':
bosses.cpp:19:9: error: 'll' was not declared in this scope; did you mean 'lt'?
   19 |         ll n,k,s,sum=INT_MAX;
      |         ^~
      |         lt
bosses.cpp:20:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   20 |         cin>>n;
      |              ^
      |              yn
bosses.cpp:21:15: error: expected ';' before 'i'
   21 |         for(ll i=1;i<=n;i++){
      |               ^~
      |               ;
bosses.cpp:21:20: error: 'i' was not declared in this scope
   21 |         for(ll i=1;i<=n;i++){
      |                    ^
bosses.cpp:22:22: error: 'k' was not declared in this scope
   22 |                 cin>>k;
      |                      ^
bosses.cpp:23:23: error: expected ';' before 'j'
   23 |                 for(ll j=1;j<=k;j++){
      |                       ^~
      |                       ;
bosses.cpp:23:28: error: 'j' was not declared in this scope
   23 |                 for(ll j=1;j<=k;j++){
      |                            ^
bosses.cpp:24:30: error: 'x' was not declared in this scope
   24 |                         cin>>x;
      |                              ^
bosses.cpp:28:15: error: expected ';' before 'i'
   28 |         for(ll i=1;i<=n;i++){
      |               ^~
      |               ;
bosses.cpp:28:20: error: 'i' was not declared in this scope
   28 |         for(ll i=1;i<=n;i++){
      |                    ^
bosses.cpp:29:23: error: expected ';' before 'j'
   29 |                 for(ll j=1;j<=n;j++){
      |                       ^~
      |                       ;
bosses.cpp:29:28: error: 'j' was not declared in this scope
   29 |                 for(ll j=1;j<=n;j++){
      |                            ^
bosses.cpp:30:25: error: 'w' was not declared in this scope
   30 |                         w[j]=0;
      |                         ^
bosses.cpp:33:19: error: expected ';' before 'c'
   33 |                 ll c=1;
      |                   ^~
      |                   ;
bosses.cpp:34:17: error: 'w' was not declared in this scope
   34 |                 w[i]=1;
      |                 ^
bosses.cpp:35:25: error: template argument 2 is invalid
   35 |                 queue<ll> g;
      |                         ^
bosses.cpp:36:19: error: request for member 'push' in 'g', which is of non-class type 'int'
   36 |                 g.push(i);
      |                   ^~~~
bosses.cpp:37:25: error: request for member 'size' in 'g', which is of non-class type 'int'
   37 |                 while(g.size()!=0){
      |                         ^~~~
bosses.cpp:38:27: error: expected ';' before 'v'
   38 |                         ll v=g.front();
      |                           ^~
      |                           ;
bosses.cpp:39:27: error: request for member 'pop' in 'g', which is of non-class type 'int'
   39 |                         g.pop();
      |                           ^~~
bosses.cpp:40:40: error: 'v' was not declared in this scope
   40 |                         for(auto u : q[v]){
      |                                        ^
bosses.cpp:42:33: error: 'c' was not declared in this scope
   42 |                                 c++;
      |                                 ^
bosses.cpp:45:35: error: request for member 'push' in 'g', which is of non-class type 'int'
   45 |                                 g.push(u);
      |                                   ^~~~
bosses.cpp:48:20: error: 'c' was not declared in this scope
   48 |                 if(c==n){
      |                    ^
bosses.cpp:49:25: error: 'sm' was not declared in this scope; did you mean 'tm'?
   49 |                         sm=0;
      |                         ^~
      |                         tm
bosses.cpp:50:25: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   50 |                         dfs(i);
      |                         ^~~
      |                         ffs
bosses.cpp:51:25: error: 'sum' was not declared in this scope
   51 |                         sum=min(sum,sm);
      |                         ^~~
bosses.cpp:54:15: error: 'sum' was not declared in this scope
   54 |         cout<<sum;
      |               ^~~