#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int mas = -n, mis = n, s = 0;
vector<int> v(n);
for (int i = 0; i < n-1; ++i){
cin >> v[i];
s += v[i];
mas = max(s, mas);
mis = min(s, mis);
}
if (max(mas, (long long)0) - min((long long)0, mis) == n-1){
int x = 5 - max(mas, (long long)0);
cout << x << ' ';
for (int i = 0; i < n-1; ++i){
x += v[i];
cout << x << ' ';
}
}
else cout << -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |