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"
int N;
long long x[500002],y[500002];
#define MOD 1000000007
int process1(){
int i,t;
long long ans,tmp;
ans = x[1];
t = tmp = 1;
for(i=2; i<=N; i++){
tmp *= x[i];
if(tmp > y[t] || tmp*y[i] > y[t]){
t = i;
ans *= (tmp%MOD); ans %= MOD;
tmp = 1;
}
}
ans *= y[t];
ans %= MOD;
return (int)ans;
}
int init(int n, int X[], int Y[]) {
int i;
for(i=1; i<=n; i++){
x[i] = (long long)X[i-1];
y[i] = (long long)Y[i-1];
}
N = n;
if(N <= 1000){
return process1();
}
}
int updateX(int pos, int val) {
if(N <= 1000){
x[pos+1] = (long long)val;
return process1();
}
}
int updateY(int pos, int val) {
if(N <= 1000){
y[pos+1] = (long long)val;
return process1();
}
}
# | 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... |