Submission #539284

#TimeUsernameProblemLanguageResultExecution timeMemory
539284MohamedFaresNebiliCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "tickets.h" /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") using namespace std; using ll = long long; using ii = pair<ll, ll>; using vi = vector<int>; using db = double; #define ff first #define ss second #define pb push_back #define all(x) x.begin(), x.end() #define lb lower_bound #define ub upper_bound const ll INF = LONG_LONG_MAX / 2; long long find_maximum(int k, vector<vector<int>> arr) { int n = arr.size(), m = arr[0].size(); vector<vector<int>> ans(n, vector<int>(m, -1)); vector<int> curr; for(int l = 0; l < n; l++) for(int i = 0; i < m; i++) ans[l][i] = 0, curr.pb(arr[l][i]); ll best = INF; for(auto u : curr) { int s = 0; for(int l = 0; l < n; l++) s += abs(arr[l][0] - u); best = min(best, s); } allocate_tickets(ans); return best; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:33:35: error: no matching function for call to 'min(ll&, int&)'
   33 |                 best = min(best, s);
      |                                   ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
tickets.cpp:33:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   33 |                 best = min(best, s);
      |                                   ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
tickets.cpp:33:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   33 |                 best = min(best, s);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
tickets.cpp:33:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |                 best = min(best, s);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
tickets.cpp:33:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |                 best = min(best, s);
      |                                   ^