This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define forsn(i, s, n) for (int i = s; i < n; i++)
#define sz(x) (int)x.size()
using namespace std;
const long long MOD = 1e9 + 7;
vector<int> globalX, globalY;
int calcmax()
{
long long best = 0, ret = (globalX[0] * globalY[0]) % MOD, cax = 1, cx = globalX[0];
forsn(i, 1, sz(globalX))
{
cx = (cx * globalX[i]) % MOD;
cax *= globalX[i];
if (globalY[best] < (cax * globalY[i]))
{
best = i;
cax = 1;
ret = (cx * globalY[i]) % MOD;
}
}
return (int)(ret % MOD);
}
int updateX(int pos, int val)
{
globalX[pos] = val;
return calcmax();
}
int updateY(int pos, int val)
{
globalY[pos] = val;
return calcmax();
}
int init(int N, int X[], int Y[])
{
globalX.resize(N), globalY.resize(N);
forn(i, N)
{
globalX[i] = X[i];
globalY[i] = Y[i];
}
return calcmax();
}
# | 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... |