This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
//#define endl '\n'
llo n;
llo it[300001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
llo mi=0;
llo ma=0;
for(llo i=1;i<n;i++){
llo aa;
cin>>aa;
it[i]=it[i-1]+aa;
mi=min(mi,it[i]);
ma=max(ma,it[i]);
}
if(ma-mi!=n-1){
cout<<-1<<endl;
}
else{
for(llo i=0;i<n;i++){
cout<<it[i]-mi+1<<" ";
}
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... |