//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;
for(int i=0;i<n;++i){
mp[a[i]]++;
a[i]+=dx;
ans&=(a[i]>0);
}
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
*
*
*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
98 ms |
23440 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
128 ms |
23392 KB |
Output is correct |
4 |
Incorrect |
38 ms |
4728 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |