# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
510253 | Toqa44 | Nizin (COCI16_nizin) | C++17 | 47 ms | 7892 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 <bits/stdc++.h>
#define endl "\n"
using namespace std ;
typedef long long ll;
typedef long double ld ;
ll n,a[1000005],sum1,sum2,ans;
map<ll,ll>mp;
vector<ll>v;
set<ll>ss;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
for(int g=0;g<n;g++)
cin>>a[g];
ll i=0; ll j=n-1;
sum1=a[i];
sum2=a[j];
while(j>i)
{
if(sum1==sum2)
{
j--;
i++;
sum1=a[i];
sum2=a[j];
}
else if(a[i]>a[j])
{
sum2+=a[j-1];
i++;
ans++;
}
else
sum1+=a[i+1];
ans++;
j--;
}
if(ans==0)
cout<<0<<endl;
else
cout<<ans-1<<endl;
return 0 ;
}
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... |
# | 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... |