# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203579 | mohammad | Horses (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.
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
#include<bits/stdc++.h>
#include "horses.h"
using namespace std;
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
ll x[500010] , y[500010] , n;
int init(int N, int X[], int Y[]){
n = N;
for(int i = 0 ; i < N ; ++i) x[i] = X[i] , y[i] = Y[i];
ll x1 = 1 , pl = 0 , ans = 1;
for(int i = max(0,n - 31) ; i < N ; ++i){
x1 *= x[i];
if(y[pl] < x1 * y[i])
x1 = 1 ,pl = i ;
}
for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M;
return (ans * y[pl]) % M;
}
int updateX(int pos, int val){
x[pos] = val;
ll x1 = 1 , pl = 0 , ans = 1;
for(int i = max(0,n - 31) ; i < n ; ++i){
x1 *= x[i];
if(y[pl] < x1 * y[i])
x1 = 1 ,pl = i ;
}
for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M;
return (ans * y[pl]) % M;
}
int updateY(int pos, int val){
y[pos] = val;
ll x1 = 1 , pl = 0 , ans = 1;
for(int i = max(0,n - 31) ; i < n; ++i){
x1 *= x[i];
if(y[pl] < x1 * y[i])
x1 = 1 ,pl = i ;
}
for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M;
return (ans * y[pl]) % M;
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)': horses.cpp:36:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i < N ; ++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:20: /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:36:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < N ; ++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:20: /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:36:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < N ; ++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:20: /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:36:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < N ; ++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:20: /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:36:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < N ; ++i){ ^ horses.cpp:41:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:41:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:41:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:41:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:41:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ horses.cpp:42:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion] return (ans * y[pl]) % M; ~~~~~~~~~~~~~~^~~ horses.cpp: In function 'int updateX(int, int)': horses.cpp:48:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i < n ; ++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:20: /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:48:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < n ; ++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:20: /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:48:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < n ; ++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:20: /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:48:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < n ; ++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:20: /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:48:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < n ; ++i){ ^ horses.cpp:53:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:53:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:53:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:53:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:53:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ horses.cpp:54:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion] return (ans * y[pl]) % M; ~~~~~~~~~~~~~~^~~ horses.cpp: In function 'int updateY(int, int)': horses.cpp:60:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i < n; ++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:20: /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:60:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < n; ++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:20: /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:60:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i < n; ++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:20: /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:60:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < n; ++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:20: /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:60:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for(int i = max(0,n - 31) ; i < n; ++i){ ^ horses.cpp:65:26: error: no matching function for call to 'max(int, ll)' for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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:20: /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:65:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}') for(int i = max(0,n - 31) ; i <= pl ; ++i) ans = (ans * x[i]) % M; ^ 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/