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>
#define ll int
using namespace std;
ll n,mx,mn,a[300005];
int main()
{
ios_base::sync_with_stdio(false);
cin>>n;
mn=0;
mx=0;
for (int i=1; i<n; i++)
{
cin>>a[i];
a[i]+=a[i-1];
mn=min(mn,a[i]);
mx=max(mx,a[i]);
}
if (mx-mn!=n-1)
{
cout<<-1<<endl;
return 0;
}
for (int i=0; i<n; i++)
printf("%d ",a[i]-mn+1);
// cout<<a[i]-mn+1<<" ";
printf("\n");
// cout<<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... |