# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1172188 | AtabayRajabli | Bigger segments (IZhO19_segments) | C++20 | 0 ms | 784 KiB |
#include <bits/stdc++.h>
#define int long long
#define all(v) v.begin(), v.end()
using namespace std;
const int sz = 3e3 + 1, inf = 1e18;
int n, a[sz];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
a[i] += a[i - 1];
}
vector<array<int, 2>> dp(n + 1, {0, 0});
array<int, 2> cur = {0, 0};
for(int i = 1; i <= n; i++) dp[i] = {1, -a[i]};
for(int i = 1; i <= n; i++)
{
cur[1] -= a[i] - a[i - 1];
cur = max(cur, dp[i]);
int l = i + 1, r = n;
while(l <= r)
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |