Submission #938903

#TimeUsernameProblemLanguageResultExecution timeMemory
938903vjudge1Bosses (BOI16_bosses)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int INF = 1e9; const int MAXN = 5e3; int N; vector<int> children[MAXN + 5]; bool visit[MAXN + 5]; int dfs(int cur, int depth) { visit[cur] = true; int ans = depth; for (auto child: children[cur]) { if (visit[child]) continue; ans += dfs(child, depth + 1); } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; for (int i = 0; i < N; i++) { int sz; cin >> sz; while (sz--) { int u; cin >> u; u--; children[i].push_back(u); } } int ans = INF; for (int i = 0; i < N; i++) { memset(visit, false, sizeof visit); ans = min(ans, dfs(i, 1)); } cout << ans << endl; return 0; }

Compilation message (stderr)

bosses.cpp: In function 'int dfs(int, int)':
bosses.cpp:12:3: error: reference to 'visit' is ambiguous
   12 |   visit[cur] = true;
      |   ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from bosses.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
bosses.cpp:9:6: note:                 'bool visit [5005]'
    9 | bool visit[MAXN + 5];
      |      ^~~~~
bosses.cpp:15:9: error: reference to 'visit' is ambiguous
   15 |     if (visit[child]) continue;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from bosses.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
bosses.cpp:9:6: note:                 'bool visit [5005]'
    9 | bool visit[MAXN + 5];
      |      ^~~~~
bosses.cpp: In function 'int main()':
bosses.cpp:33:12: error: reference to 'visit' is ambiguous
   33 |     memset(visit, false, sizeof visit);
      |            ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from bosses.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
bosses.cpp:9:6: note:                 'bool visit [5005]'
    9 | bool visit[MAXN + 5];
      |      ^~~~~
bosses.cpp:33:33: error: reference to 'visit' is ambiguous
   33 |     memset(visit, false, sizeof visit);
      |                                 ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from bosses.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
bosses.cpp:9:6: note:                 'bool visit [5005]'
    9 | bool visit[MAXN + 5];
      |      ^~~~~