제출 #138213

#제출 시각아이디문제언어결과실행 시간메모리
138213Sorting말 (IOI15_horses)C++14
17 / 100
1559 ms4216 KiB
#include <bits/stdc++.h>

using namespace std;

const long long mod = 1e9 + 7;
const int N = 5e5 + 7;
const long long T = 1e9;

int n, *x, *y;
int first;

long long init(int _n, int _x[], int _y[]){
	n = _n;
	x = _x;
	y = _y;

	long long curr = 1, ans = 0;

	for(int i = n - 1; i >= 0; i--){
		curr *= (long long) x[i];

		if(curr > T){
			break;
		}
		first = i;
	}

	curr = 1;

	for(int i = first; i < n; i++){
		curr *= (long long)x[i];

		ans = max(ans, (long long)curr * (long long)y[i]);
	}
	ans %= mod;

	for(int i = 0; i < first; i++){
		ans *= (long long)x[i];
		ans %= mod;
	}

	return ans;
}

long long updateX(int pos, int val){
	x[pos] = val;

	return init(n, x, y);
}

long long updateY(int pos, int val){
	y[pos] = val;

	return init(n, x, y);
}
#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...