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