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;
using ll = long long;
int main() {
int n;
cin >> n;
vector <ll> d(n-1);
for (int i = 0; i < n-1; i++)
cin >> d[i];
vector <ll> nums(n);
nums[0] = 0;
for (int i = 0; i < n; i++) {
nums[i+1] = nums[i] + d[i];
}
ll x = *min_element(nums.begin(), nums.end());
x--;
for (int i = 0; i < n; i++)
nums[i] += (-x);
if (*max_element(nums.begin(), nums.end()) < n)
cout << -1 << '\n';
else {
for (auto i : nums)
cout << i << ' ';
cout << '\n';
}
}
# | 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... |