# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088722 | 2024-09-14T21:55:40 Z | gustavo_d | Horses (IOI15_horses) | C++17 | 1500 ms | 12124 KB |
#include "horses.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 500000; const ll MOD = 1e9+7; int n; vector<ll> x(MAXN), y(MAXN); int init(int N, int X[], int Y[]) { n = N+1; for (int i=1; i<n; i++) x[i] = (ll)X[i-1]; for (int i=1; i<n; i++) y[i] = (ll)Y[i-1]; ll ans = 0; ll qtd = 1; for (int i=1; i<n; i++) { qtd = (qtd * x[i]) % MOD; ans = max(ans, (qtd * y[i]) % MOD); } 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; ll ans = 0; ll qtd = 1; for (int i=1; i<n; i++) { qtd = (qtd * x[i]) % MOD; ans = max(ans, (qtd * y[i]) % MOD); } return ans; } int updateY(int pos, int val) { y[pos+1] = val; ll ans = 0; ll qtd = 1; for (int i=1; i<n; i++) { qtd = (qtd * x[i]) % MOD; ans = max(ans, (qtd * y[i]) % MOD); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8028 KB | Output is correct |
2 | Correct | 3 ms | 8028 KB | Output is correct |
3 | Correct | 3 ms | 8060 KB | Output is correct |
4 | Correct | 3 ms | 8028 KB | Output is correct |
5 | Correct | 3 ms | 8028 KB | Output is correct |
6 | Correct | 3 ms | 8064 KB | Output is correct |
7 | Correct | 3 ms | 8028 KB | Output is correct |
8 | Correct | 3 ms | 8028 KB | Output is correct |
9 | Correct | 3 ms | 8024 KB | Output is correct |
10 | Correct | 3 ms | 8028 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8220 KB | Output is correct |
13 | Correct | 3 ms | 8028 KB | Output is correct |
14 | Correct | 3 ms | 8028 KB | Output is correct |
15 | Correct | 3 ms | 8024 KB | Output is correct |
16 | Correct | 3 ms | 8028 KB | Output is correct |
17 | Correct | 3 ms | 8028 KB | Output is correct |
18 | Correct | 3 ms | 8028 KB | Output is correct |
19 | Correct | 3 ms | 8024 KB | Output is correct |
20 | Correct | 3 ms | 8028 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8028 KB | Output is correct |
2 | Correct | 3 ms | 8028 KB | Output is correct |
3 | Correct | 3 ms | 8028 KB | Output is correct |
4 | Correct | 3 ms | 8028 KB | Output is correct |
5 | Correct | 3 ms | 8028 KB | Output is correct |
6 | Correct | 3 ms | 8028 KB | Output is correct |
7 | Correct | 3 ms | 8028 KB | Output is correct |
8 | Correct | 3 ms | 8028 KB | Output is correct |
9 | Correct | 3 ms | 8028 KB | Output is correct |
10 | Correct | 3 ms | 8028 KB | Output is correct |
11 | Correct | 3 ms | 8028 KB | Output is correct |
12 | Correct | 3 ms | 8028 KB | Output is correct |
13 | Correct | 3 ms | 8028 KB | Output is correct |
14 | Correct | 3 ms | 8028 KB | Output is correct |
15 | Correct | 3 ms | 8028 KB | Output is correct |
16 | Correct | 3 ms | 8024 KB | Output is correct |
17 | Correct | 3 ms | 8156 KB | Output is correct |
18 | Correct | 3 ms | 8280 KB | Output is correct |
19 | Correct | 3 ms | 8028 KB | Output is correct |
20 | Correct | 3 ms | 8176 KB | Output is correct |
21 | Incorrect | 3 ms | 8028 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1567 ms | 12124 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8024 KB | Output is correct |
2 | Correct | 3 ms | 8028 KB | Output is correct |
3 | Correct | 3 ms | 8028 KB | Output is correct |
4 | Correct | 3 ms | 8180 KB | Output is correct |
5 | Correct | 3 ms | 8228 KB | Output is correct |
6 | Correct | 3 ms | 8140 KB | Output is correct |
7 | Correct | 3 ms | 8028 KB | Output is correct |
8 | Correct | 3 ms | 8024 KB | Output is correct |
9 | Correct | 3 ms | 8028 KB | Output is correct |
10 | Correct | 3 ms | 8028 KB | Output is correct |
11 | Correct | 3 ms | 8028 KB | Output is correct |
12 | Correct | 3 ms | 8028 KB | Output is correct |
13 | Correct | 3 ms | 8028 KB | Output is correct |
14 | Correct | 3 ms | 8188 KB | Output is correct |
15 | Correct | 3 ms | 8028 KB | Output is correct |
16 | Correct | 3 ms | 8028 KB | Output is correct |
17 | Correct | 3 ms | 8272 KB | Output is correct |
18 | Correct | 3 ms | 8028 KB | Output is correct |
19 | Correct | 3 ms | 8196 KB | Output is correct |
20 | Correct | 3 ms | 8028 KB | Output is correct |
21 | Incorrect | 3 ms | 8028 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8028 KB | Output is correct |
2 | Correct | 3 ms | 8028 KB | Output is correct |
3 | Correct | 3 ms | 8280 KB | Output is correct |
4 | Correct | 3 ms | 8028 KB | Output is correct |
5 | Correct | 3 ms | 8028 KB | Output is correct |
6 | Correct | 3 ms | 8028 KB | Output is correct |
7 | Correct | 3 ms | 8028 KB | Output is correct |
8 | Correct | 3 ms | 8028 KB | Output is correct |
9 | Correct | 3 ms | 8028 KB | Output is correct |
10 | Correct | 3 ms | 8028 KB | Output is correct |
11 | Correct | 3 ms | 8028 KB | Output is correct |
12 | Correct | 3 ms | 8024 KB | Output is correct |
13 | Correct | 3 ms | 8028 KB | Output is correct |
14 | Correct | 3 ms | 8028 KB | Output is correct |
15 | Correct | 3 ms | 8028 KB | Output is correct |
16 | Correct | 3 ms | 8028 KB | Output is correct |
17 | Correct | 3 ms | 8028 KB | Output is correct |
18 | Correct | 3 ms | 8028 KB | Output is correct |
19 | Correct | 3 ms | 8048 KB | Output is correct |
20 | Correct | 3 ms | 8024 KB | Output is correct |
21 | Incorrect | 3 ms | 8104 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |