# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658921 | Jeff12345121 | 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.
#include <bits/stdc++.h>
#include "horses.h"
#define REP(i,n) for(int i = 1; i <= (n); i++)
using namespace std;
#ifdef LOCAL
ifstream in("in.in");
ofstream out("out.out");
#endif
const int nmax = 1005;
int n,x[nmax],y[nmax],inf = (1LL << 60),MOD = 1000000007;
int init(int tn, int* tx,int* ty) {
n = tn;
for (int i = 0; i < n; i++) {
x[i] = tx[i];
y[i] = ty[i];
}
int horses = 1,max_sol = -inf;
for (int i = 0; i < n; i++) {
horses = 1LL * horses * x[i] % MOD;
max_sol = max(max_sol , 1LL * horses * y[i] % MOD);
}
return max_sol;
}
int updateX(int pos, int val) {
x[pos] = val;
int horses = 1,max_sol = -inf;
for (int i = 0; i < n; i++) {
horses = 1LL * horses * x[i] % MOD;
max_sol = max(max_sol , 1LL * horses * y[i] % MOD);
}
return max_sol;
}
int updateY(int pos, int val) {
y[pos] = val;
int horses = 1,max_sol = -inf;
for (int i = 0; i < n; i++) {
horses = 1LL * horses * x[i] % MOD;
max_sol = max(max_sol , 1LL * horses * y[i] % MOD);
}
return max_sol;
}
#ifdef LOCAL
/*int tx[nmax],ty[nmax];
int32_t main() {
in >> n;
for (int i = 0; i < n; i++) {
in >> tx[i];
}
for (int i = 0; i < n; i++) {
in >> ty[i];
}
out << init(n,tx,ty) << "\n";
int m;
in >> m;
for (int i = 0; i < m; i++) {
int type,pos,val;
in >> type >> pos >> val;
if (type == 0) {
out << updateX(pos, val);
}
if (type == 1) {
out << updateY(pos,val);
}
}
}*/
#endif
Compilation message (stderr)
horses.cpp:13:34: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow] 13 | int n,x[nmax],y[nmax],inf = (1LL << 60),MOD = 1000000007; | ~~~~~^~~~~~ horses.cpp: In function 'int init(int, int*, int*)': horses.cpp:24:38: warning: conversion from 'long long int' to 'int' may change value [-Wconversion] 24 | horses = 1LL * horses * x[i] % MOD; | ~~~~~~~~~~~~~~~~~~~~^~~~~ horses.cpp:25:58: error: no matching function for call to 'max(int&, long long int)' 25 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: horses.cpp:25:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 25 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: horses.cpp:25:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 25 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: horses.cpp:25:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 25 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: horses.cpp:25:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 25 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ horses.cpp: In function 'int updateX(int, int)': horses.cpp:34:38: warning: conversion from 'long long int' to 'int' may change value [-Wconversion] 34 | horses = 1LL * horses * x[i] % MOD; | ~~~~~~~~~~~~~~~~~~~~^~~~~ horses.cpp:35:58: error: no matching function for call to 'max(int&, long long int)' 35 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: horses.cpp:35:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 35 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: horses.cpp:35:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 35 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: horses.cpp:35:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: horses.cpp:35:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ horses.cpp: In function 'int updateY(int, int)': horses.cpp:45:38: warning: conversion from 'long long int' to 'int' may change value [-Wconversion] 45 | horses = 1LL * horses * x[i] % MOD; | ~~~~~~~~~~~~~~~~~~~~^~~~~ horses.cpp:46:58: error: no matching function for call to 'max(int&, long long int)' 46 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: horses.cpp:46:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 46 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from horses.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: horses.cpp:46:58: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 46 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: horses.cpp:46:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 46 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from horses.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: horses.cpp:46:58: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 46 | max_sol = max(max_sol , 1LL * horses * y[i] % MOD); | ^