# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416593 | victoriad | Horses (IOI15_horses) | C++14 | 19 ms | 16168 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;
vector<int>lista1;
vector<int>lista2;
vector<int>lista3;
int m;
int init(int N, int X[], int Y[]) {
lista1.resize(N);
lista2.resize(N);
for(int i=0;i<N;i++)lista2[i]=Y[i];
for(int i=0;i<N;i++)lista3[i]=X[i];
int a=0;
int y=0;
int mod=1e9+7;
int j=1;
int r2=1;
for(int i=0;i<N;i++){
r2*=X[i];
r2%=(mod);
lista1[i]=r2;
j=max(j,r2*Y[i]);
}
j%=mod;
m=j;
return j;
}
int updateX(int pos, int val) {
int mod=1e9+7;
int a=lista3[pos];
lista3[pos]=val;
for(int i=pos;i<lista3.size();i++){
lista1[i]/=a;
lista1[i]*=val;
if(lista2[i]*lista1[i]>m){
m=lista2[i]*lista1[i];
m%=mod;
}
}
return m;
}
int updateY(int pos, int val) {
int mod=1e9+7;
if(lista1[pos]*val>m){
m=lista1[pos]*val%mod;
}
return m;
}
Compilation message (stderr)
# | 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... |