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;
long long a,b,c,d,i,e,f,g,n,m,k,l,A[500005],minn,maxx;
int main() {
cin>>n;
A[1]=1;
for(long long i=1;i<n;i++) {
cin>>a;
A[i+1]=A[i]+a;
}
minn=A[1];
for(long long i=1;i<=n;i++) {
minn=min(minn,A[i]);
}
for(long long i=1;i<=n;i++) {
A[i]+=(1-minn);
maxx=max(maxx,A[i]);
}
if(maxx!=n) { cout<<-1; return 0; }
for(long long i=1;i<=n;i++) {
cout<<A[i]<<" ";
}
}
# | 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... |