Submission #120585

#TimeUsernameProblemLanguageResultExecution timeMemory
120585khulegubHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h" #include<bits/stdc++.h> #define ll(x) x*2+1 #define rr(x) x*2+2 using namespace std; typedef long long i64; i64 mod = 1e9 + 7; // vector<i64> st; vector<i64> arr; int n; // void build(int l, int r, int node){ // if(l == r){ // st[node] = arr[l]; // return ; // } // int mid = (l + r) >> 1; // build(l, mid, ll(node)); // build(mid+1, rr, rr(node)); // st[node] = max(st[ll(node)], st[rr(node)]); // } // i64 query(int l, int r, ) // void update(int pos, int val, int l, int r, int node){ // } int init(int N, int X[], int Y[]) { n=N; int mx=1; for(int i = 0; i < N; i++){ arr[i] = X[i] * Y[i]; if(i > 0) arr[i] *= arr[i-1]; mx = max(mx, arr[i]); } // st.resize(4*N); // build(0, N-1, 0); return mx; } int updateX(int pos, int val) { return 0; } int updateY(int pos, int val) { return 0; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:40:22: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type&)'
   mx = max(mx, arr[i]);
                      ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from horses.cpp:2:
/usr/include/c++/7/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++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
horses.cpp:40:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}')
   mx = max(mx, arr[i]);
                      ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from horses.cpp:2:
/usr/include/c++/7/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++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
horses.cpp:40:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}')
   mx = max(mx, arr[i]);
                      ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from horses.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
horses.cpp:40:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   mx = max(mx, arr[i]);
                      ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from horses.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468: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++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
horses.cpp:40:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   mx = max(mx, arr[i]);
                      ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:47:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val) { 
                 ^~~
horses.cpp:47:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val) { 
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:51:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val) {
                 ^~~
horses.cpp:51:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val) {
                          ^~~