Submission #870835

#TimeUsernameProblemLanguageResultExecution timeMemory
870835pccLabels (NOI20_labels)C++14
100 / 100
45 ms5724 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 3e5+10;
int arr[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 1;i<n;i++)cin>>arr[i];
	int sm = 0,big = 0;
	int now = 0;
	for(int i = 1;i<n;i++){
		now += arr[i];
		sm = min(sm,now);
		big = max(big,now);
	}
	if(big-sm+1 != n){
		cout<<-1;
		return 0;
	}
	now = 0;
	for(int i = 0;i<n;i++){
		now += arr[i];
		cout<<now-sm+1<<' ';
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...