Submission #594339

#TimeUsernameProblemLanguageResultExecution timeMemory
594339FatihSolakThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> #define N 200005 using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> rem[N]; vector<int> get(int x){ if(rem[x].size())return rem[x]; return rem[x] = ask(x); } const int block = 256; int find_best(int n){ long long maxi = 0; while(maxi * maxi + 1 < n){ int point = rng()%n; maxi = max(maxi,get(point)[0] + get(point)[1]); } int p = 0; while(1){ int now = get(p)[0] + get(p)[1]; if(now != maxi){ if(now == 0){ return p; } } else{ int pos = p - get(p)[0]; int l = p,r= n-1; while(l < r){ int m = (l + r + 1)/2; int val = get(m)[0] + get(m)[1]; if(val != maxi || m - get(m)[0] != pos + (m-p)){ r = m-1; } else l = m; } p = l; } p++; } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:16:48: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   16 |   maxi = max(maxi,get(point)[0] + get(point)[1]);
      |                                                ^
In file included from /usr/include/c++/10/vector:60,
                 from prize.h:1,
                 from prize.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:
prize.cpp:16:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   16 |   maxi = max(maxi,get(point)[0] + get(point)[1]);
      |                                                ^
In file included from /usr/include/c++/10/vector:60,
                 from prize.h:1,
                 from prize.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:
prize.cpp:16:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   16 |   maxi = max(maxi,get(point)[0] + get(point)[1]);
      |                                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:2:
/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:
prize.cpp:16:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |   maxi = max(maxi,get(point)[0] + get(point)[1]);
      |                                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:2:
/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:
prize.cpp:16:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |   maxi = max(maxi,get(point)[0] + get(point)[1]);
      |                                                ^