Submission #600285

# Submission time Handle Problem Language Result Execution time Memory
600285 2022-07-20T16:19:11 Z Codula Labels (NOI20_labels) C++17
0 / 100
122 ms 21340 KB
//IOI 2023 I am coming.
 
#include "bits/stdc++.h"
 
using namespace std;
 
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define int int64_t
#define pb push_back 
 
int32_t main(){
	fast;
	int n;
	cin>>n;
	vector<int>a(n);
	a[0]=0;
	int dy=0;
	for(int i=1;i<n;++i){
		int dx;
		cin>>dx;
		a[i]=a[i-1]+dx;
		dy=max(dy,a[i]);
	}
	map<int,int>mp;
	int dx=n-dy;
	int ans=1;
	//~ cerr<<dx<<"\n";
	for(int i=0;i<n;++i){
		ans&=(mp[a[i]]==0&&((a[i]+dx)<=0));
		mp[a[i]]++;
		a[i]+=dx;
	}
	if(ans==0){
		cout<<"-1\n";
	}
	else{
		for(auto i:a)cout<<i<<" ";
		cout<<"\n";
	}
    return 0;
}

//1 6 4 2 5 3
/*
 * 5 2 2 3 2
 * 
 * 
 * 
*/








# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 122 ms 21340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -