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(){
cin.tie(0);
ios_base::sync_with_stdio(0);
int n;
cin>>n;
vector<int> v(n);
int minv = 0;
int maxv = 0;
int cur = 0;
for (int i = 1; i<n; i++){
cin>>v[i];
cur+=v[i];
minv=min(minv,cur);
maxv=max(maxv,cur);
}
if (maxv-minv==n-1){
int cur = n-maxv;
cout<<cur<<' ';
for (int i = 1; i<n; i++){
cur+=v[i];
cout<<cur<<' ';
}
cout<<'\n';
} else {
cout<<-1<<'\n';
}
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... |