Submission #285068

#TimeUsernameProblemLanguageResultExecution timeMemory
285068Bill_00Rice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; #define ll long long int besthub(int R, int L, int a[], long long B) { long long dp[100001]; dp[0]=0; for(int i=1;i<R;i++){ dp[i]=dp[i-1]+(ll)a[i]-(ll)a[0]; } ll l=1,r=R; while(l!=r){ ll mid=(l+r)>>1,flag=0; for(ll i=mid-1;i<(ll)R;i++){ ll MID=(i*2+1-mid)>>1; ll left=i+1-mid; long long cost=dp[i]-dp[MID]-((i-MID)*((ll)a[MID]-(ll)a[0]))+(((ll)a[MID]-(ll)a[left])*(MID-left+1)-(dp[MID]-dp[left]-(MID-left)*((ll)a[left]-(ll)a[0]))); if(cost<=B){ flag++; break; } } if(flag==0) r=mid; else l=mid+1; } return max(l-1,1); }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:27:18: error: no matching function for call to 'max(long long int, int)'
   27 |  return max(l-1,1);
      |                  ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from ricehub.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
ricehub.cpp:27:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |  return max(l-1,1);
      |                  ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from ricehub.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
ricehub.cpp:27:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |  return max(l-1,1);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
ricehub.cpp:27:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |  return max(l-1,1);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
ricehub.cpp:27:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |  return max(l-1,1);
      |                  ^