This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N; int D[N], mx = 0, mn = 0; D[0] = 0;
for(int i = 1; i < N; i++) {
cin >> D[i]; D[i] += D[i - 1];
mx = max(mx, D[i]); mn = min(mn, D[i]);
}
if(mx - mn == N - 1) {
for(int i = 0; i < N; i++) {
cout << D[i] + 1 - mn << " ";
}
} else cout << -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |