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 "vector"
#include "cmath"
#include "algorithm"
#include "utility"
using namespace std;
int maxi(int N, int X[], int Y[],int nodo,int ca,int di,int mayor){
if(nodo==N-1){
return ca*X[N-1]*Y[N-1]+di;
}
ca*=X[nodo];
int a=mayor;
int j=ca;
for(int i=0;i<=ca;i++){
int b=maxi(N,X,Y,nodo+1,j,di+Y[nodo]*i,mayor);
j--;
if(b>a){
a=b;
}
}
return max(a,mayor);
}
int init(int N, int X[], int Y[]) {
int r=maxi(N,X,Y,0,1,0,0);
return r;
}
int updateX(int pos, int val) {
return 0;
}
int updateY(int pos, int val) {
return 0;
}
Compilation message (stderr)
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:29:17: warning: unused parameter 'pos' [-Wunused-parameter]
29 | int updateX(int pos, int val) {
| ~~~~^~~
horses.cpp:29:26: warning: unused parameter 'val' [-Wunused-parameter]
29 | int updateX(int pos, int val) {
| ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:33:17: warning: unused parameter 'pos' [-Wunused-parameter]
33 | int updateY(int pos, int val) {
| ~~~~^~~
horses.cpp:33:26: warning: unused parameter 'val' [-Wunused-parameter]
33 | int updateY(int pos, int val) {
| ~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |