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 <iostream>
#define ll long long
using namespace std;
int n;
long long pref[300001];
int main()
{
ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
ll mn = 0, mx = 0;
for (int i = 1; i < n; i++)
{
int x; cin >> x;
pref[i] = pref[i - 1] + x;
mn = min(mn, pref[i]);
mx = max(mx, pref[i]);
}
if (mx - mn + 1 == n)
{
ll sft = -mn + 1;
for (int i = 0; i < n; i++)
{
cout << pref[i] + sft;
if (i < n) cout << " ";
}
cout << "\n";
}
else {cout << "-1\n";}
return 0;
}
# | 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... |