# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996791 | 2024-06-11T08:21:11 Z | daffuwu | Bigger segments (IZhO19_segments) | C++14 | 1 ms | 2424 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 dp[3069][3069], n, a, mx = -1e9; long long ps[500069]; int main() { int i, j, idx; scanf("%d", &n); for (i=1; i<=n; i++) { scanf("%d", &a); ps[i] = ps[i-1]+a; } ps[n+1] = 1e17; for (i=1; i<=n; i++) { for (idx=i+1, j=i-1; idx<=n+1; idx++) { mx = -1e9; for (; j>=0 && ps[idx]-ps[i]>=ps[i]-ps[j]; j--) { mx = max(mx, 1+dp[j][i]); } dp[i][idx] = mx; // printf("dp[%d][%d] = %d\n", i, idx, dp[i][idx]); } // printf("\n"); } printf("%d\n", dp[n][n+1]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2424 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2424 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2424 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2424 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2424 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2392 KB | Output is correct |
6 | Incorrect | 0 ms | 2396 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |