# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
257535 | 2020-08-04T11:37:37 Z | BThero | Bigger segments (IZhO19_segments) | C++17 | 1500 ms | 70912 KB |
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAXN = (int)3e3 + 5; const ll INF = (ll)1e16; ll dp[MAXN][MAXN]; int arr[MAXN]; int n; void solve() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &arr[i]); } for (int i = 0; i <= n; ++i) { for (int j = 0; j <= n; ++j) { dp[i][j] = INF; } } dp[0][0] = 0; for (int i = 1; i <= n; ++i) { ll cur = 0; for (int j = i; j; --j) { cur += arr[j]; for (int k = 1; k <= n; ++k) { if (dp[j - 1][k - 1] <= cur) { dp[i][k] = min(dp[i][k], cur); } } } } int ans = n; while (dp[n][ans] == INF) { --ans; } printf("%d\n", ans); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 0 ms | 384 KB | Output is correct |
10 | Correct | 0 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 0 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 0 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 0 ms | 384 KB | Output is correct |
10 | Correct | 0 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 0 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 0 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
16 | Correct | 57 ms | 4356 KB | Output is correct |
17 | Correct | 54 ms | 4352 KB | Output is correct |
18 | Correct | 57 ms | 4352 KB | Output is correct |
19 | Correct | 62 ms | 4352 KB | Output is correct |
20 | Correct | 61 ms | 4352 KB | Output is correct |
21 | Correct | 56 ms | 4352 KB | Output is correct |
22 | Correct | 31 ms | 3264 KB | Output is correct |
23 | Correct | 14 ms | 2304 KB | Output is correct |
24 | Correct | 73 ms | 4352 KB | Output is correct |
25 | Correct | 56 ms | 4352 KB | Output is correct |
26 | Correct | 61 ms | 4352 KB | Output is correct |
27 | Correct | 57 ms | 4352 KB | Output is correct |
28 | Correct | 56 ms | 4352 KB | Output is correct |
29 | Correct | 62 ms | 4472 KB | Output is correct |
30 | Correct | 61 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 0 ms | 384 KB | Output is correct |
10 | Correct | 0 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 0 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 0 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
16 | Correct | 57 ms | 4356 KB | Output is correct |
17 | Correct | 54 ms | 4352 KB | Output is correct |
18 | Correct | 57 ms | 4352 KB | Output is correct |
19 | Correct | 62 ms | 4352 KB | Output is correct |
20 | Correct | 61 ms | 4352 KB | Output is correct |
21 | Correct | 56 ms | 4352 KB | Output is correct |
22 | Correct | 31 ms | 3264 KB | Output is correct |
23 | Correct | 14 ms | 2304 KB | Output is correct |
24 | Correct | 73 ms | 4352 KB | Output is correct |
25 | Correct | 56 ms | 4352 KB | Output is correct |
26 | Correct | 61 ms | 4352 KB | Output is correct |
27 | Correct | 57 ms | 4352 KB | Output is correct |
28 | Correct | 56 ms | 4352 KB | Output is correct |
29 | Correct | 62 ms | 4472 KB | Output is correct |
30 | Correct | 61 ms | 4352 KB | Output is correct |
31 | Execution timed out | 1592 ms | 70912 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 0 ms | 384 KB | Output is correct |
10 | Correct | 0 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 0 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 0 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
16 | Correct | 57 ms | 4356 KB | Output is correct |
17 | Correct | 54 ms | 4352 KB | Output is correct |
18 | Correct | 57 ms | 4352 KB | Output is correct |
19 | Correct | 62 ms | 4352 KB | Output is correct |
20 | Correct | 61 ms | 4352 KB | Output is correct |
21 | Correct | 56 ms | 4352 KB | Output is correct |
22 | Correct | 31 ms | 3264 KB | Output is correct |
23 | Correct | 14 ms | 2304 KB | Output is correct |
24 | Correct | 73 ms | 4352 KB | Output is correct |
25 | Correct | 56 ms | 4352 KB | Output is correct |
26 | Correct | 61 ms | 4352 KB | Output is correct |
27 | Correct | 57 ms | 4352 KB | Output is correct |
28 | Correct | 56 ms | 4352 KB | Output is correct |
29 | Correct | 62 ms | 4472 KB | Output is correct |
30 | Correct | 61 ms | 4352 KB | Output is correct |
31 | Execution timed out | 1592 ms | 70912 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 0 ms | 384 KB | Output is correct |
10 | Correct | 0 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 0 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 0 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
16 | Correct | 57 ms | 4356 KB | Output is correct |
17 | Correct | 54 ms | 4352 KB | Output is correct |
18 | Correct | 57 ms | 4352 KB | Output is correct |
19 | Correct | 62 ms | 4352 KB | Output is correct |
20 | Correct | 61 ms | 4352 KB | Output is correct |
21 | Correct | 56 ms | 4352 KB | Output is correct |
22 | Correct | 31 ms | 3264 KB | Output is correct |
23 | Correct | 14 ms | 2304 KB | Output is correct |
24 | Correct | 73 ms | 4352 KB | Output is correct |
25 | Correct | 56 ms | 4352 KB | Output is correct |
26 | Correct | 61 ms | 4352 KB | Output is correct |
27 | Correct | 57 ms | 4352 KB | Output is correct |
28 | Correct | 56 ms | 4352 KB | Output is correct |
29 | Correct | 62 ms | 4472 KB | Output is correct |
30 | Correct | 61 ms | 4352 KB | Output is correct |
31 | Execution timed out | 1592 ms | 70912 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |