//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){
ans&=(mp[a[i]]==0);
mp[a[i]]++;
a[i]+=dx;
}
if(ans==0){
cout<<"-1\n";
}
else{
for(auto i:a)cout<<i<<" ";
cout<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
147 ms |
24008 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
158 ms |
24240 KB |
Output is correct |
4 |
Correct |
15 ms |
3176 KB |
Output is correct |
5 |
Correct |
32 ms |
3412 KB |
Output is correct |
6 |
Correct |
99 ms |
12756 KB |
Output is correct |
7 |
Correct |
99 ms |
12572 KB |
Output is correct |
8 |
Correct |
28 ms |
3384 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |