제출 #353680

#제출 시각아이디문제언어결과실행 시간메모리
353680antontsiorvas말 (IOI15_horses)C++14
17 / 100
1591 ms8192 KiB
#include "horses.h"
#include <algorithm>

int n, x[500005], y[500005];

int init(int N, int X[], int Y[]) {
	for(int i=0; i<N; i++){
		x[i] = X[i];
		y[i] = Y[i];
	}
	n = N;
	int horses=1, ret=0;
	for(int i=0; i<N; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	return ret;
}

int updateX(int pos, int val) {	
	x[pos] = val;
	int horses=1, ret=0;
	for(int i=0; i<n; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	return ret;
}

int updateY(int pos, int val) {
	y[pos] = val;
	int horses=1, ret=0;
	for(int i=0; i<n; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	return ret;
}
#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...