#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
#define MOD (1'000'000'000 + 7)
#define F(i, n) for(int i = 0; i < (n); i++)
#define F_reverse(i, n) for(int i = (n - 1); i >= 0; i--)
int N;
int X[2000], Y[2000];
int solve() {
__int128_t h = 1;
bool compare = true;
F_reverse(i, N) {
if(compare) {
if(Y[i] > h) {
h = Y[i];
}
h *= X[i];
if(h >= 1'000'000'000) {
compare = false;
h %= MOD;
}
} else {
h *= X[i];
h %= MOD;
}
}
return h;
}
int init(int _N, int _X[], int _Y[]) {
N = _N;
F(i, N) {
X[i] = _X[i];
Y[i] = _Y[i];
}
return solve();
}
int updateX(int pos, int val) {
X[pos] = val;
return solve();
}
int updateY(int pos, int val) {
Y[pos] = val;
return solve();
}
# | 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... |