제출 #18654

#제출 시각아이디문제언어결과실행 시간메모리
18654suhgyuho_william말 (IOI15_horses)C++98
34 / 100
56 ms12812 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...