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 main()
{
int N;
cin>>N;
int V[N];
for(int i = 0;i<N;i++) cin>>V[i];
int i = 0;
int l = N-1;
int somma1 = V[0];
int somma2 = V[N-1];
int conta = 0;
while(i<=l)
{
if(somma1>somma2)
{
conta++;
somma2+=V[l-1];
l--;
}
else if(somma2 > somma1)
{
conta++;
somma1+=V[i+1];
i++;
}
else
{
i++;
l--;
somma1 = V[i];
somma2 = V[l];
}
}
cout<<conta;
}
# | 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... |