Submission #38963

#TimeUsernameProblemLanguageResultExecution timeMemory
38963faustaadpThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #include<bits/stdc++.h> #define ll long long using namespace std; ll l,r,c,ma; vector<int> v; int find_best(int n) { for(int i = 0; i < n; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; if(res[0]+res[1]!=ma) continue; ma=max(ma,res[0]+res[1]); l=i+1; r=n-1; while(l<=r) { c=(l+r)/2; v=ask(c); if(v[0]==res[0]&&v[1]==res[1]) { i=c; l=c+1; } else r=c-1; } } return 0; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:14:26: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type)'
   ma=max(ma,res[0]+res[1]);
                          ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
prize.cpp:14:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
   ma=max(ma,res[0]+res[1]);
                          ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
prize.cpp:14:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')
   ma=max(ma,res[0]+res[1]);
                          ^
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from prize.cpp:2:
/usr/include/c++/5/bits/stl_algo.h:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^
/usr/include/c++/5/bits/stl_algo.h:3457:5: note:   template argument deduction/substitution failed:
prize.cpp:14:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ma=max(ma,res[0]+res[1]);
                          ^
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from prize.cpp:2:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   template argument deduction/substitution failed:
prize.cpp:14:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ma=max(ma,res[0]+res[1]);
                          ^