Submission #865377

#TimeUsernameProblemLanguageResultExecution timeMemory
865377AlebnA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include "books.h" #define ll long long using namespace std; void solve(int n, int k, ll A, int S) { vector<ll> a(n); ll sum = 0, mid = -1; for(int i = 0; i < n; i++) { a[i] = skim(i+1); if(a[i] >= A && mid == -1) mid = i; } for(int i = 0; i < k-1; i++) sum+=a[i]; mid = min(mid, k); for(int i = mid; i > k-1; i--) { if(sum+a[mid] >= A && sum+a[mid] <= 2*A) { vector<int> b(k); for(int j = 0; j < k-1; j++) b[j] = j; b[k] = i; answer(b); } if(i == k) { impossible(); break; } } }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:16:21: error: no matching function for call to 'min(long long int&, int&)'
   16 |     mid = min(mid, k);
      |                     ^
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from books.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:
books.cpp:16:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   16 |     mid = min(mid, k);
      |                     ^
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from books.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:
books.cpp:16:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   16 |     mid = min(mid, k);
      |                     ^