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>
#define ll long long
using namespace std;
const int MAXN = 3e5+5;
ll dp[MAXN];
int main()
{
int N; cin >> N;
ll minn = 0, maxx = 0;
for(int i = 2;i<=N;++i){
ll x; cin >> x;
dp[i] = dp[i-1]+x;
minn = min(dp[i],minn); maxx = max(dp[i],maxx);
}
if(maxx-minn < N-1){
cout << -1 << "\n";
return 0;
}
for(int i = 1;i<=N;++i) cout << dp[i]-minn+1 << " ";
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... |