#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();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
304 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
304 KB |
Output is correct |
9 |
Correct |
1 ms |
296 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
300 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
300 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
296 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
6 ms |
340 KB |
Output is correct |
24 |
Correct |
6 ms |
340 KB |
Output is correct |
25 |
Correct |
8 ms |
308 KB |
Output is correct |
26 |
Correct |
7 ms |
328 KB |
Output is correct |
27 |
Correct |
5 ms |
212 KB |
Output is correct |
28 |
Correct |
6 ms |
340 KB |
Output is correct |
29 |
Correct |
6 ms |
212 KB |
Output is correct |
30 |
Correct |
6 ms |
340 KB |
Output is correct |
31 |
Correct |
5 ms |
340 KB |
Output is correct |
32 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1566 ms |
10276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
296 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
6 ms |
308 KB |
Output is correct |
24 |
Correct |
6 ms |
312 KB |
Output is correct |
25 |
Correct |
6 ms |
340 KB |
Output is correct |
26 |
Correct |
7 ms |
480 KB |
Output is correct |
27 |
Correct |
5 ms |
340 KB |
Output is correct |
28 |
Correct |
6 ms |
332 KB |
Output is correct |
29 |
Correct |
5 ms |
212 KB |
Output is correct |
30 |
Correct |
6 ms |
336 KB |
Output is correct |
31 |
Correct |
6 ms |
292 KB |
Output is correct |
32 |
Correct |
6 ms |
340 KB |
Output is correct |
33 |
Execution timed out |
1548 ms |
12052 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
296 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
296 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
296 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
296 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
296 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
6 ms |
340 KB |
Output is correct |
24 |
Correct |
7 ms |
340 KB |
Output is correct |
25 |
Correct |
7 ms |
332 KB |
Output is correct |
26 |
Correct |
6 ms |
316 KB |
Output is correct |
27 |
Correct |
6 ms |
340 KB |
Output is correct |
28 |
Correct |
7 ms |
340 KB |
Output is correct |
29 |
Correct |
5 ms |
212 KB |
Output is correct |
30 |
Correct |
6 ms |
340 KB |
Output is correct |
31 |
Correct |
6 ms |
212 KB |
Output is correct |
32 |
Correct |
6 ms |
212 KB |
Output is correct |
33 |
Execution timed out |
1573 ms |
10292 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |