# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022459 | 2024-07-13T14:31:42 Z | daffuwu | Split the sequence (APIO14_sequence) | C++14 | 2000 ms | 8536 KB |
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, k, opt[100002][202]; long long ps[100069], dp[100069][2], val; int main() { int i, j, c; scanf("%d%d", &n, &k); k++; for (i=1; i<=n; i++) { scanf("%lld", ps+i); ps[i] += ps[i-1]; dp[i][0] = -1e12; } for (c=1; c<=k; c++) { dp[0][c%2] = -1e12; for (i=1; i<=n; i++) { dp[i][c%2] = 0; for (j=i-1; j>=0; j--) { val = dp[j][(c+1)%2]+(ps[i]-ps[j])*ps[j]; if (val>dp[i][c%2]) { dp[i][c%2] = val; opt[i][c] = j; } } } } printf("%lld\n", dp[n][k%2]); for (i=n, c=k; c>=2; i=opt[i][c], c--) { printf("%d ", opt[i][c]); } printf("\n"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | contestant found the optimal answer: 108 == 108 |
2 | Correct | 1 ms | 348 KB | contestant found the optimal answer: 999 == 999 |
3 | Incorrect | 0 ms | 348 KB | Integer 0 violates the range [1, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | contestant found the optimal answer: 1093956 == 1093956 |
2 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 302460000 == 302460000 |
3 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 122453454361 == 122453454361 |
4 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 93663683509 == 93663683509 |
5 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 1005304678 == 1005304678 |
6 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 933702 == 933702 |
7 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 25082842857 == 25082842857 |
8 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 687136 == 687136 |
9 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 27295930079 == 27295930079 |
10 | Correct | 0 ms | 348 KB | contestant found the optimal answer: 29000419931 == 29000419931 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | contestant found the optimal answer: 610590000 == 610590000 |
2 | Correct | 0 ms | 604 KB | contestant found the optimal answer: 311760000 == 311760000 |
3 | Correct | 5 ms | 604 KB | contestant found the optimal answer: 1989216017013 == 1989216017013 |
4 | Correct | 1 ms | 604 KB | contestant found the optimal answer: 1499437552673 == 1499437552673 |
5 | Correct | 4 ms | 604 KB | contestant found the optimal answer: 1019625819 == 1019625819 |
6 | Correct | 5 ms | 604 KB | contestant found the optimal answer: 107630884 == 107630884 |
7 | Correct | 5 ms | 604 KB | contestant found the optimal answer: 475357671774 == 475357671774 |
8 | Correct | 1 ms | 604 KB | contestant found the optimal answer: 193556962 == 193556962 |
9 | Correct | 1 ms | 604 KB | contestant found the optimal answer: 482389919803 == 482389919803 |
10 | Correct | 2 ms | 444 KB | contestant found the optimal answer: 490686959791 == 490686959791 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1116 KB | contestant found the optimal answer: 21503404 == 21503404 |
2 | Correct | 3 ms | 1268 KB | contestant found the optimal answer: 140412195 == 140412195 |
3 | Correct | 103 ms | 1116 KB | contestant found the optimal answer: 49729674225461 == 49729674225461 |
4 | Incorrect | 3 ms | 1116 KB | declared answer doesn't correspond to the split scheme: declared = 38984609480023, real = 35986227316423 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 217 ms | 8352 KB | contestant found the optimal answer: 1818678304 == 1818678304 |
2 | Correct | 225 ms | 8532 KB | contestant found the optimal answer: 1326260195 == 1326260195 |
3 | Execution timed out | 2041 ms | 8536 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2075 ms | 2652 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |