이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |