Submission #841259

#TimeUsernameProblemLanguageResultExecution timeMemory
841259serifefedartarPolitical Development (BOI17_politicaldevelopment)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; #define f first #define s second #define MOD 1000000007 #define LOGN 20 #define MAXN 200005 vector<vector<int>> graph; vector<pair<int,int>> degree; set<pair<int,int>> edges; bool omit[MAXN]; int main() { fast int N, K, x, D; cin >> N >> K; graph = vector<vector<int>>(N, vector<int>()); degree = vector<pair<int,int>>(N); for (int i = 0; i < N; i++) degree[i] = {0, i}; for (int i = 0; i < N; i++) { cin >> D; for (int j = 0; j < D; j++) { cin >> x; graph[x].push_back(i); graph[i].push_back(x); edges.insert({min(x, i), max(x, i)}); degree[i].f++; degree[x].f++; } } sort(degree.begin(), degree.end()); int ans = 1; for (auto u : degree) { int node = u.s; vector<int> adj; for (auto p : graph[node]) { if (!omit[p]) adj.push_back(p); } int degree = adj.size(); int mx_mask = (1<<degree) - 1; for (int msk = 1; msk <= mx_mask; msk++) { vector<int> taken; taken.push_back(node); bool check = true; for (int j = 0; j < degree; j++) { if ((1<<j) & msk) { for (auto u : taken) { if (edges.count({min(adj[j], u), max(adj[j], u)}) == 0) check = false; } taken.push_back(adj[j]); } } if (check) ans = max(ans, taken.size()); } omit[node] = true; } cout << ans << "\n"; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:65:32: error: no matching function for call to 'max(int&, std::vector<int>::size_type)'
   65 |     ans = max(ans, taken.size());
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:65:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   65 |     ans = max(ans, taken.size());
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:65:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   65 |     ans = max(ans, taken.size());
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:65:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   65 |     ans = max(ans, taken.size());
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from politicaldevelopment.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
politicaldevelopment.cpp:65:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   65 |     ans = max(ans, taken.size());
      |                                ^