Submission #98966

#TimeUsernameProblemLanguageResultExecution timeMemory
98966zicon35Bosses (BOI16_bosses)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int n,k,v; vector< vector<int>> adj; int d[20005]; int bfs(int root) { memset(d, -1, sizeof d); queueue<int> queue; que.push(root); d[root] = 1; while(!que.empty()) { int x = que.front(); que.pop(); for(auto i : adj[x]) { if(d[i] == -1) { d[i] = 1 + d[x]; que.push(i); } } } int a = 0; for(int i = 1; i <= n; i++) { if(d[i] == -1) return -1; else a += d[i]; } return a; } int solve(){ int k,v; cin>>n; adj.resize(n+2); for(int i=1;i<=n;i++){ cin>>k; for(int j=1;j<=k;j++){ cin>>v; adj[v].push_back(i); } } int ans = INT_MAX; for(int i=1;i<=n;i++){ int x = bfs(i); if(x == -1) continue; ans = min(ans,x); } return ans; } int main(){ cout<<solve()<<endl; return 0; }

Compilation message (stderr)

bosses.cpp: In function 'int bfs(int)':
bosses.cpp:13:2: error: 'queueue' was not declared in this scope
  queueue<int> queue;
  ^~~~~~~
bosses.cpp:13:2: note: suggested alternative: 'sigqueue'
  queueue<int> queue;
  ^~~~~~~
  sigqueue
bosses.cpp:13:10: error: expected primary-expression before 'int'
  queueue<int> queue;
          ^~~
bosses.cpp:14:2: error: 'que' was not declared in this scope
  que.push(root);
  ^~~