Submission #819687

# Submission time Handle Problem Language Result Execution time Memory
819687 2023-08-10T12:36:52 Z Gangsta Horses (IOI15_horses) C++14
Compilation error
0 ms 0 KB
/*
ID: didarco1
LANG: C++17
TASK:
*/
// a >> b = a / pow(2,b)
// a << b = a * pow(2,b)
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define sz size()
#define ss second
#define ff first
#define N 200001
#define pii pair<int,int>
#define all(x) (x.begin(),x.end())

using namespace std;

ll  MOD = 1e9+7;

ll mod(ll x){
	if(x >= MOD) x %= MOD;
	return x;
}

void updateX(int pos, int val){
	pos++;
	val++;
}

void updateY(int pos, int val){
	pos++;
	val++;
}

//
//void upd(int nd, int l, int r, int x, int y){
//	if(l == r and l == y){
//		sell[i]
//	}
//}

int init(int n, vector <int> X, vector<int> Y){
	ll hrs = 1;
	int mx = 0;
//	for(int i = 1; i <= n; i++){
//		hrs *= X[i];
//		sell[i] = hrs * Y[i];
//	}
//	for(int i = 1; i <= n; i++){
//		upd(1,1,n,i,sell[i]);
//	}
	for(int i = 0; i < n; i++){
		hrs = mod((hrs * X[i]));
		mx = max(mx,mod((hrs*Y[i])));
	}
	return mx;
}

//int main(){
//	int x;
//	cin >> n;
//	for(int i = 0; i < n; i++){
//		cin >> x;
//		X.pb(x);
//	}
//	for(int i = 0; i < n; i++){
//		cin >> x;
//		Y.pb(x);
//	}
//	init(n,X,Y);
//}

Compilation message

horses.cpp: In function 'int init(int, std::vector<int>, std::vector<int>)':
horses.cpp:56:30: error: no matching function for call to 'max(int&, long long int)'
   56 |   mx = max(mx,mod((hrs*Y[i])));
      |                              ^
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:8:
/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:56:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   56 |   mx = max(mx,mod((hrs*Y[i])));
      |                              ^
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:8:
/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:56:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   56 |   mx = max(mx,mod((hrs*Y[i])));
      |                              ^
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:8:
/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:56:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   56 |   mx = max(mx,mod((hrs*Y[i])));
      |                              ^
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:8:
/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:56:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   56 |   mx = max(mx,mod((hrs*Y[i])));
      |                              ^