#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
int a[300005],d,maxm,minm;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t=1,n;
// cin >> t;
while (t--){
cin >> n;
a[0] = 0;
maxm = 0;
minm = 0;
for (int i = 0; i < n; i++){
cin >> d;
a[i+1] = a[i]+d;
maxm = max(maxm,a[i+1]);
minm = min(minm,a[i+1]);
}
if (maxm-minm != n-1){
cout << "-1\n";
continue;
}
int diff = 1-minm;
for (int i = 0; i < n; i++){
cout << a[i] + diff << " ";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
2860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |