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;
#define MAXN 1000100
long long vet[MAXN];
int main(){
int n;
cin >> n;
for(int i=1; i<=n; i++){
cin >> vet[i];
}
int resp=0;
int atuali=0, atualj=0;
for(int i=1, j=n; i<j;){
if(vet[i]+atuali==vet[j]+atualj){
atuali=atualj=0;
i++;
j--;
continue;
}
resp++;
if(vet[i]+atuali<vet[j]+atualj){
atuali+=vet[i];
i++;
continue;
}
else{
atualj+=vet[j];
j--;
continue;
}
}
cout << resp << 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... |