#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const int MX_COW=1000;
const int MAXN = 500000;
int n;
vector<int> x(MAXN), y(MAXN);
int init(int N, int X[], int Y[]) {
n = N+1;
for (int i=1; i<n; i++) x[i] = X[i-1];
for (int i=1; i<n; i++) y[i] = Y[i-1];
int ans = 0;
int qtd = 1;
for (int i=1; i<n; i++) {
qtd *= x[i];
ans = max(ans, qtd * y[i]);
}
return ans;
// int dp[n][MX_COW+1];
// for (int i=1; i<=MX_COW; i++) {
// dp[0][i] = -1e9;
// }
// dp[0][1] = 0;
// for (int i=1; i<n; i++) {
// for (int cow=0; cow<=MX_COW; cow++) {
// dp[i][cow] = -1e9;
// for (int v=0; v<=MX_COW; v++) {
// if ((cow+v)/x[i] > MX_COW) continue;
// if ((cow+v) % x[i] != 0) continue;
// dp[i][cow] = max(
// dp[i][cow],
// dp[i-1][(cow + v) / x[i]] + v * y[i]
// );
// }
// }
// }
// return dp[n-1][0];
}
int updateX(int pos, int val) {
x[pos+1] = val;
int ans = 0;
int qtd = 1;
for (int i=1; i<n; i++) {
qtd *= x[i];
ans = max(ans, qtd * y[i]);
}
return ans;
}
int updateY(int pos, int val) {
y[pos+1] = val;
int ans = 0;
int qtd = 1;
for (int i=1; i<n; i++) {
qtd *= x[i];
ans = max(ans, qtd * y[i]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4184 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
1 ms |
4184 KB |
Output is correct |
4 |
Correct |
2 ms |
4188 KB |
Output is correct |
5 |
Correct |
1 ms |
4188 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
1 ms |
4188 KB |
Output is correct |
9 |
Correct |
1 ms |
4188 KB |
Output is correct |
10 |
Correct |
1 ms |
4188 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
2 ms |
4184 KB |
Output is correct |
13 |
Correct |
2 ms |
4184 KB |
Output is correct |
14 |
Correct |
2 ms |
4184 KB |
Output is correct |
15 |
Correct |
2 ms |
4184 KB |
Output is correct |
16 |
Correct |
1 ms |
4188 KB |
Output is correct |
17 |
Correct |
1 ms |
4188 KB |
Output is correct |
18 |
Correct |
1 ms |
4188 KB |
Output is correct |
19 |
Correct |
2 ms |
4188 KB |
Output is correct |
20 |
Correct |
1 ms |
4188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4184 KB |
Output is correct |
3 |
Correct |
2 ms |
4184 KB |
Output is correct |
4 |
Correct |
1 ms |
4184 KB |
Output is correct |
5 |
Correct |
1 ms |
4188 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
2 ms |
4188 KB |
Output is correct |
9 |
Correct |
2 ms |
4188 KB |
Output is correct |
10 |
Correct |
1 ms |
4188 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
2 ms |
4188 KB |
Output is correct |
13 |
Correct |
2 ms |
4188 KB |
Output is correct |
14 |
Correct |
2 ms |
4188 KB |
Output is correct |
15 |
Correct |
2 ms |
4188 KB |
Output is correct |
16 |
Correct |
2 ms |
4188 KB |
Output is correct |
17 |
Correct |
2 ms |
4188 KB |
Output is correct |
18 |
Correct |
2 ms |
4188 KB |
Output is correct |
19 |
Correct |
2 ms |
4188 KB |
Output is correct |
20 |
Correct |
2 ms |
4188 KB |
Output is correct |
21 |
Incorrect |
2 ms |
4188 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1573 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
2 ms |
4188 KB |
Output is correct |
4 |
Correct |
2 ms |
4188 KB |
Output is correct |
5 |
Correct |
2 ms |
4216 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
2 ms |
4188 KB |
Output is correct |
9 |
Correct |
2 ms |
4188 KB |
Output is correct |
10 |
Correct |
2 ms |
4188 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
2 ms |
4184 KB |
Output is correct |
13 |
Correct |
2 ms |
4188 KB |
Output is correct |
14 |
Correct |
2 ms |
4188 KB |
Output is correct |
15 |
Correct |
2 ms |
4188 KB |
Output is correct |
16 |
Correct |
2 ms |
4188 KB |
Output is correct |
17 |
Correct |
2 ms |
4188 KB |
Output is correct |
18 |
Correct |
2 ms |
4440 KB |
Output is correct |
19 |
Correct |
1 ms |
4188 KB |
Output is correct |
20 |
Correct |
2 ms |
4188 KB |
Output is correct |
21 |
Incorrect |
2 ms |
4188 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4184 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
2 ms |
4188 KB |
Output is correct |
4 |
Correct |
2 ms |
4188 KB |
Output is correct |
5 |
Correct |
2 ms |
4188 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
1 ms |
4188 KB |
Output is correct |
9 |
Correct |
2 ms |
4188 KB |
Output is correct |
10 |
Correct |
2 ms |
4184 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
1 ms |
4188 KB |
Output is correct |
13 |
Correct |
2 ms |
4188 KB |
Output is correct |
14 |
Correct |
1 ms |
4188 KB |
Output is correct |
15 |
Correct |
2 ms |
4188 KB |
Output is correct |
16 |
Correct |
2 ms |
4188 KB |
Output is correct |
17 |
Correct |
2 ms |
4172 KB |
Output is correct |
18 |
Correct |
2 ms |
4188 KB |
Output is correct |
19 |
Correct |
2 ms |
4188 KB |
Output is correct |
20 |
Correct |
2 ms |
4188 KB |
Output is correct |
21 |
Incorrect |
1 ms |
4188 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |