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()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N; cin >> N;
ll mn = 0, mx = 0;
for(int i = 1;i<N;++i){
ll d; cin >> d;
dp[i] = dp[i-1] + d;
mn = min(mn,dp[i]); mx = max(mx,dp[i]);
}
if(mx-mn < N-1){
cout << -1 << "\n";
return 0;
}
for(int i = 0;i<N;++i) cout << dp[i]-mn+1 << " ";
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... |