# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770639 | Amylopectin | Bigger segments (IZhO19_segments) | C++14 | 1 ms | 212 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 <stdio.h>
#include <iostream>
using namespace std;
const int mxn = 1e6 + 10;
int a[mxn] = {};
int main()
{
int i,j,n,m,cou = 1,be,csu,lo,dif;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
be = a[0];
csu = 0;
lo = 1;
for(i=1; i<n; i++)
{
csu += a[i];
if(csu >= be)
{
dif = csu - be;
for(j=lo; j<i; j++)
{
if(a[j] * 2 > dif)
{
break;
}
dif -= a[j] * 2;
csu -= a[j];
}
be = csu;
cou ++;
csu = 0;
}
}
printf("%d\n",cou);
}
Compilation message (stderr)
# | 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... |