# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62616 | Vahan | Split the sequence (APIO14_sequence) | C++17 | 61 ms | 5088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
using namespace std;
long long d[201][100007],n,k,a[200000],ss;
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>a[i];
ss+=a[i];
}
long long s=0;
for(int i=1;i<=n;i++)
{
s+=a[i];
for(int j=0;j<=min(i-1,200);j++)
{
if(j==0)
{
d[i][j]=s*s;
continue;
}
long long e=0;
for(int z=i;z>=j+1;z--)
{
e+=a[z];
if(d[i][j]==0)
d[i][j]=e*e+d[z-1][j-1];
d[i][j]=min(d[i][j],e*e+d[z-1][j-1]);
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |