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 <bits/stdc++.h>
using namespace std;
int a[1000007],n,l,r,ans;
int main()
{
cin>>n;
for (int i=0; i<n; i++)
{
cin>>a[i];
}
l=0;
r=n-1;
while (l<n/2)
{
if (a[l]==a[r])
{
l++;
r--;
}
while (r>n/2 && a[l]!=a[r])
{
if (a[l]>a[r])
{
a[r-1]+=a[r];
r--;
n--;
ans++;
}
else
{
a[l+1]+=a[l];
l++;
ans++;
}
}
}
cout<<ans;
return 0;
}
# | 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... |
# | 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... |