#include <bits/stdc++.h>
#include "horses.h"
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
int n;
vector<ll> X(5*maxn), Y(maxn);
vector<double> logX(5*maxn), logY(maxn);
int calc() {
ll curr = 1, id = -1, p1 = 0;
double ls = 0, ans = -1;
for(int i=0; i<n; i++) {
curr = (curr * X[i]) % mod;
ls += logX[i];
if(ls + logY[i] > ans) {
ans = ls + logY[i];
id = i;
p1 = curr;
}
}
ll res = (p1 * Y[id]) % mod;
return (int)res;
}
int init(int N, int x[], int y[]) {
n = N;
for(int i=0; i<n; i++) {
X[i] = x[i], Y[i] = y[i];
logX[i] = log10(X[i]), logY[i] = log10(y[i]);
}
return calc();
}
int updateX(int p, int v) {
X[p] = v, logX[p] = log10(v);
return calc();
}
int updateY(int p, int v) {
Y[p] = v, logY[p] = log10(v);
return calc();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
3 ms |
9740 KB |
Output is correct |
5 |
Correct |
3 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
3 ms |
9820 KB |
Output is correct |
10 |
Correct |
3 ms |
9820 KB |
Output is correct |
11 |
Correct |
3 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
3 ms |
9816 KB |
Output is correct |
15 |
Correct |
3 ms |
9820 KB |
Output is correct |
16 |
Correct |
3 ms |
9820 KB |
Output is correct |
17 |
Correct |
3 ms |
9816 KB |
Output is correct |
18 |
Correct |
3 ms |
9820 KB |
Output is correct |
19 |
Correct |
3 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
3 ms |
9820 KB |
Output is correct |
4 |
Correct |
2 ms |
9820 KB |
Output is correct |
5 |
Correct |
3 ms |
9828 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
3 ms |
9816 KB |
Output is correct |
10 |
Correct |
3 ms |
9820 KB |
Output is correct |
11 |
Correct |
3 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9816 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
3 ms |
9820 KB |
Output is correct |
15 |
Correct |
4 ms |
9820 KB |
Output is correct |
16 |
Correct |
3 ms |
9732 KB |
Output is correct |
17 |
Correct |
3 ms |
9820 KB |
Output is correct |
18 |
Correct |
2 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9808 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
21 |
Correct |
2 ms |
9820 KB |
Output is correct |
22 |
Correct |
3 ms |
9820 KB |
Output is correct |
23 |
Correct |
8 ms |
9820 KB |
Output is correct |
24 |
Correct |
9 ms |
9880 KB |
Output is correct |
25 |
Correct |
8 ms |
10020 KB |
Output is correct |
26 |
Correct |
8 ms |
9820 KB |
Output is correct |
27 |
Correct |
7 ms |
9820 KB |
Output is correct |
28 |
Correct |
7 ms |
9872 KB |
Output is correct |
29 |
Correct |
8 ms |
9820 KB |
Output is correct |
30 |
Correct |
8 ms |
10072 KB |
Output is correct |
31 |
Correct |
7 ms |
9820 KB |
Output is correct |
32 |
Correct |
8 ms |
9816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1548 ms |
13748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
9820 KB |
Output is correct |
2 |
Correct |
2 ms |
9820 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
3 ms |
9820 KB |
Output is correct |
5 |
Correct |
3 ms |
9820 KB |
Output is correct |
6 |
Correct |
4 ms |
9820 KB |
Output is correct |
7 |
Correct |
3 ms |
10072 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
3 ms |
9820 KB |
Output is correct |
10 |
Correct |
2 ms |
9820 KB |
Output is correct |
11 |
Correct |
3 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
3 ms |
9820 KB |
Output is correct |
15 |
Correct |
3 ms |
9820 KB |
Output is correct |
16 |
Correct |
3 ms |
9820 KB |
Output is correct |
17 |
Correct |
3 ms |
9820 KB |
Output is correct |
18 |
Correct |
3 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9720 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
21 |
Correct |
3 ms |
9820 KB |
Output is correct |
22 |
Correct |
3 ms |
9852 KB |
Output is correct |
23 |
Correct |
8 ms |
9820 KB |
Output is correct |
24 |
Correct |
8 ms |
9820 KB |
Output is correct |
25 |
Correct |
8 ms |
9900 KB |
Output is correct |
26 |
Correct |
8 ms |
9816 KB |
Output is correct |
27 |
Correct |
8 ms |
9820 KB |
Output is correct |
28 |
Correct |
7 ms |
9820 KB |
Output is correct |
29 |
Correct |
8 ms |
9816 KB |
Output is correct |
30 |
Correct |
7 ms |
9816 KB |
Output is correct |
31 |
Correct |
7 ms |
9820 KB |
Output is correct |
32 |
Correct |
7 ms |
9820 KB |
Output is correct |
33 |
Execution timed out |
1577 ms |
17672 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
9820 KB |
Output is correct |
2 |
Correct |
3 ms |
9820 KB |
Output is correct |
3 |
Correct |
2 ms |
9820 KB |
Output is correct |
4 |
Correct |
3 ms |
9820 KB |
Output is correct |
5 |
Correct |
3 ms |
9820 KB |
Output is correct |
6 |
Correct |
3 ms |
9820 KB |
Output is correct |
7 |
Correct |
3 ms |
9820 KB |
Output is correct |
8 |
Correct |
3 ms |
9820 KB |
Output is correct |
9 |
Correct |
3 ms |
9820 KB |
Output is correct |
10 |
Correct |
3 ms |
9820 KB |
Output is correct |
11 |
Correct |
3 ms |
9820 KB |
Output is correct |
12 |
Correct |
3 ms |
9820 KB |
Output is correct |
13 |
Correct |
3 ms |
9820 KB |
Output is correct |
14 |
Correct |
3 ms |
9820 KB |
Output is correct |
15 |
Correct |
3 ms |
9772 KB |
Output is correct |
16 |
Correct |
3 ms |
9820 KB |
Output is correct |
17 |
Correct |
3 ms |
9820 KB |
Output is correct |
18 |
Correct |
3 ms |
9820 KB |
Output is correct |
19 |
Correct |
2 ms |
9820 KB |
Output is correct |
20 |
Correct |
3 ms |
9820 KB |
Output is correct |
21 |
Correct |
3 ms |
9816 KB |
Output is correct |
22 |
Correct |
3 ms |
9820 KB |
Output is correct |
23 |
Correct |
8 ms |
9816 KB |
Output is correct |
24 |
Correct |
9 ms |
9820 KB |
Output is correct |
25 |
Correct |
8 ms |
9860 KB |
Output is correct |
26 |
Correct |
7 ms |
9820 KB |
Output is correct |
27 |
Correct |
8 ms |
9820 KB |
Output is correct |
28 |
Correct |
7 ms |
9820 KB |
Output is correct |
29 |
Correct |
7 ms |
9820 KB |
Output is correct |
30 |
Correct |
7 ms |
9820 KB |
Output is correct |
31 |
Correct |
8 ms |
9820 KB |
Output is correct |
32 |
Correct |
7 ms |
9820 KB |
Output is correct |
33 |
Execution timed out |
1575 ms |
15908 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |