Submission #79543

#TimeUsernameProblemLanguageResultExecution timeMemory
79543MoesashiMinamotoBosses (BOI16_bosses)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n; vector< int > acc[5003]; int m; int vis[5003]; int pa[5003]; vector<int> g[5003]; int sal[5003]; long long dfs(int u, int root) { if (u == root) { for (int i = 1; i <= n; i++) { sal[i] = 1ll*n*(n-1)/2; } } long long res = 1; for (auto v : g[u]) { res += dfs(v, root); } sal[u] = res; if (u != root) return res; else { res = 0; for (int i = 1; i <= n; i++) { res += sal[i]; } return res; } } int fouck(int pos) { queue<int> q; q.push(pos); memset(vis, 0, sizeof(vis)); vis[pos] = 1; for (int i = 1; i <= n; i++) { g[i].clear(); } while (!q.empty()) { int u = q.front(); q.pop(); for (auto v : acc[u]) { if (!vis[v]) { q.push(v); g[u].push_back(v); vis[v] = 1; } } } return dfs(pos, pos); } signed main() { int x, y; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", &m); for (int j = 1; j <= m; j ++) { scanf("%d", &x); acc[x].push_back(i); } } long long res = LLONG_MAX; for (int i = 1; i <= n; i++) { res = min(res, fouck(i)); } cout << res; }

Compilation message (stderr)

bosses.cpp: In function 'int main()':
bosses.cpp:67:26: error: no matching function for call to 'min(long long int&, int)'
   res = min(res, fouck(i));
                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from bosses.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
bosses.cpp:67:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   res = min(res, fouck(i));
                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from bosses.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
bosses.cpp:67:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   res = min(res, fouck(i));
                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bosses.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
bosses.cpp:67:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   res = min(res, fouck(i));
                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bosses.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
bosses.cpp:67:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   res = min(res, fouck(i));
                          ^
bosses.cpp:56:9: warning: unused variable 'y' [-Wunused-variable]
  int x, y;
         ^
bosses.cpp:57:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
bosses.cpp:59:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &m);
   ~~~~~^~~~~~~~~~
bosses.cpp:61:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &x);
    ~~~~~^~~~~~~~~~