| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 353848 | antontsiorvas | 말 (IOI15_horses) | C++14 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "horses.h"
#include <algorithm>
int x[500005], y[500005];
int init(int N, int X[], int Y[]) {
for(int i=0; i<N; i++){
x[i] = X[i];
y[i] = Y[i];
}
int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}
int updateX(int pos, int val) {
x[pos] = val;
int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}
int updateY(int pos, int val) {
y[pos] = val;
int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:17:47: error: no matching function for call to 'max(long long int&, int)'
17 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:17:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
17 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:17:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
17 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:17:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
17 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:17:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
17 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
horses.cpp:19:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
19 | int ret2 = ret;
| ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:27:17: error: 'N' was not declared in this scope
27 | for(int i=0; i<N; i++){
| ^
horses.cpp:31:47: error: no matching function for call to 'max(long long int&, int)'
31 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:31:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
31 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:31:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
31 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:31:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
31 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:31:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
31 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
horses.cpp:33:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
33 | int ret2 = ret;
| ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:41:17: error: 'N' was not declared in this scope
41 | for(int i=0; i<N; i++){
| ^
horses.cpp:45:47: error: no matching function for call to 'max(long long int&, int)'
45 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:45:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
45 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from horses.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:
horses.cpp:45:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
45 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:45:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
45 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
In file included from /usr/include/c++/9/algorithm:62,
from horses.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:
horses.cpp:45:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
45 | ret = std::max(ret, (horses*y[i])%1000000007);
| ^
horses.cpp:47:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
47 | int ret2 = ret;
| ^~~