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 n,mn,mx,a[300005],k,b;
int main(){
cin>>n;
a[1]=0;mn=mx=0;
for(k=1;k<n;k++){
cin>>b;
a[k+1]=a[k]+b;
mn=min(mn,a[k+1]);
mx=max(mx,a[k+1]);
}
if(mx+1-mn<n)cout<<-1;
else {
for(k=1;k<=n;k++){
cout<<a[k]+(1-mn)<<" ";
}
}
}
# | 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... |