Submission #234220

#TimeUsernameProblemLanguageResultExecution timeMemory
234220AASGHorses (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
int init(int N, int X[], int Y[]) {
    int V[N];
    V[0]=X[0];
    int mx=0;
    for(int i=1;i<N;i++)V[i]=V[i-1]*X[i];

    for(int i=0;i<N;i++)mx=max(V[i]*Y[i]);
	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:10:41: error: no matching function for call to 'max(int)'
     for(int i=0;i<N;i++)mx=max(V[i]*Y[i]);
                                         ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 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:10:41: note:   candidate expects 2 arguments, 1 provided
     for(int i=0;i<N;i++)mx=max(V[i]*Y[i]);
                                         ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 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:10:41: note:   candidate expects 3 arguments, 1 provided
     for(int i=0;i<N;i++)mx=max(V[i]*Y[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:10:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
     for(int i=0;i<N;i++)mx=max(V[i]*Y[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:10:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
     for(int i=0;i<N;i++)mx=max(V[i]*Y[i]);
                                         ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:14:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val) {
                 ^~~
horses.cpp:14:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val) {
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:18:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val) {
                 ^~~
horses.cpp:18:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val) {
                          ^~~