# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95090 | Rouge_Hugo | Nizin (COCI16_nizin) | C++14 | 9 ms | 1704 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>
using namespace std;
int a[100009];
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int re=0;
long long sum=0,sum1=0;
for(int i=0,j=n-1;i<n,j>-1;i++,j--)
{
sum+=a[i];
sum1+=a[j];
while (sum!=sum1&&i<j)
{
if (sum>sum1)
{re++;
j--;
sum1+=a[j];
continue;
}
else if (sum1>sum)
{
re++;
i++;
sum+=a[i];
continue;
}
else break;
}
}
cout<<re;
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... |