# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416624 | victoriad | Horses (IOI15_horses) | C++14 | 1585 ms | 13980 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;
int mod=1e9+7;
vector<int>lista1;
vector<int>lista2;
vector<int>lista3;
vector<double>lista4;
int m;
double lm;
int init(int N, int X[], int Y[]) {
lista1.resize(N);
lista2.resize(N);
lista3.resize(N);
lista4.resize(N);
for(int i=0;i<N;i++)lista2[i]=Y[i];
for(int i=0;i<N;i++)lista3[i]=X[i];
double j=0;
double r2=0;
int a=1;
int o=0;
for(int i=0;i<N;i++){
r2+=log10(X[i]);
lista4[i]=r2;
lista1[i]=a*X[i];
lista1[i]%=mod;
a=lista1[i];
if(r2+log10(Y[i])>j){
j=r2+log10(Y[i]);
o=i;
}
}
lm=j;
m=lista1[o]%mod;
m*=Y[o];
m%=mod;
return m;
}
int updateX(int pos, int val) {
double j=lm;
double r2=0;
int a=1;
int o=0;
lista3[pos]=val;
for(int i=0;i<lista3.size();i++){
r2+=log10(lista3[i]);
lista4[i]=r2;
lista1[i]=a*lista3[i];
lista1[i]%=mod;
a=lista1[i];
if(r2+log10(lista2[i])>j){
j=r2+log10(lista2[i]);
o=i;
}
}
lm=j;
m=lista1[o]%mod;
m*=lista2[o];
m%=mod;
return m;
}
int updateY(int pos, int val) {
double j=lm;
double r2=0;
int a=1;
int o=0;
lista2[pos]=val;
for(int i=0;i<lista3.size();i++){
r2+=log10(lista3[i]);
lista4[i]=r2;
lista1[i]=a*lista3[i];
lista1[i]%=mod;
a=lista1[i];
if(r2+log10(lista2[i])>j){
j=r2+log10(lista2[i]);
o=i;
}
}
lm=j;
m=lista1[o]%mod;
m*=lista2[o];
m%=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... |