# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416535 | victoriad | Horses (IOI15_horses) | C++14 | 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 "vector"
#include "cmath"
#include "algorithm"
#include "utility"
using namespace std;
using namespace std;
long long int maxi(int N, int X[], int Y[],int nodo,int ca,long long di,long long int mayor){
if(nodo==N-1){
return ca*X[N-1]*Y[N-1]+di;
}
ca*=X[nodo];
long long int a=mayor;
int j=ca;
for(int i=0;i<ca;i++){
long long 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[]) {
long long int r=maxi(N,X,Y,0,1,0,0);
int mod=1e+7;
r%=(mod);
int a=r;
return a;
}