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>
#define intt long long
using namespace std;
intt minop(intt arr[], intt n)
{
intt ans = 0;
for (int i=0,j=n-1; i<=j;)
{
if (arr[i] == arr[j])
{
i++;
j--;
}
else if (arr[i] > arr[j])
{
j--;
arr[j] += arr[j+1] ;
ans++;
}
else
{
i++;
arr[i] += arr[i-1];
ans++;
}
}
return ans;
}
intt arr[1234567];
int main()
{
intt n;
cin>>n;
for(intt i=0;i<n;i++)cin>>arr[i];
cout<<minop(arr,n)<<endl;
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... |