# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95558 | oolimry | Nizin (COCI16_nizin) | C++14 | 86 ms | 10232 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 main()
{
int n;
//freopen("i.txt","r",stdin);
scanf("%d",&n);
long long arr[n];
for(int i = 0;i < n;i++){
scanf("%lld",&arr[i]);
}
int lindex = 0;
long long lsum = arr[0];
int rindex = n-1;
long long rsum = arr[n-1];
int steps = 0;
while(lindex < rindex){
//printf("%d %d\n",lindex,rindex);
if(lsum == rsum){
lindex++;
rindex--;
rsum = arr[rindex];
lsum = arr[lindex];
}
else if(lsum > rsum){
rindex--;
rsum += arr[rindex];
steps++;
}
else{
lindex++;
lsum += arr[lindex];
steps++;
}
}
printf("%d",steps);
for(int i = 0;i < n;i++){
//printf("%lld ",arr[i]);
}
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... |