Submission #951263

# Submission time Handle Problem Language Result Execution time Memory
951263 2024-03-21T14:04:01 Z Nelt Split the sequence (APIO14_sequence) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll intersection(ll k, ll b, ll k1, ll b1)
{
    if (k == k1)
        return -1;
    return (ll)((b1 - b) / (k - k1 + 0.0));
}
void solve()
{
    ll n, k;
    cin >> n >> k;
    ll dp[2][n + 1], a[n + 1];
    int best[k + 1][n + 1];
    for (ll i = 0; i <= k; i++)
    for (ll j = 0; j <= n; j++)
        best[i][j] = 0;
    a[0] = 0;
    for (ll i = 1; i <= n; i++)
        cin >> a[i], a[i] += a[i - 1];
    for (ll i = 0; i <= n; i++)
        dp[0][i] = 0, dp[1][i] = -1e18;
    vector<array<ll, 3>> v;
    for (ll i = 1; i <= k; i++)
    {
        v.clear();
        for (ll j = 0; j <= n; j++)
        {
            while (!v.empty() and v.back()[0] * 
        }
        // for (ll j = 1; j <= n; j++)
        //     dp[i & 1][j] = max(dp[(i + 1) & 1][m] + (a[j] - a[m]) * (a[n] - a[j]), dp[i & 1][j]);
    }
    ll ans = 0;
    for (ll i = 1; i < n; i++)
        ans = max(ans, dp[k & 1][i]);
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // precomp();
    // cin >> t;
    for (ll i = 1; i <= t; i++)
        solve();
    cerr << "\nTime elapsed: " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
}

Compilation message

sequence.cpp: In function 'void solve()':
sequence.cpp:32:9: error: expected primary-expression before '}' token
   32 |         }
      |         ^
sequence.cpp:31:48: error: expected ')' before '}' token
   31 |             while (!v.empty() and v.back()[0] *
      |                   ~                            ^
      |                                                )
   32 |         }
      |         ~                                       
sequence.cpp:32:9: error: expected primary-expression before '}' token
   32 |         }
      |         ^