이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |