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
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,d[2000005],p;
int main(){
ios::sync_with_stdio(false);
cin >> n;
ll l = 1 , r = n;
for(int i=1; i<n; i++){
cin >> d[i];
p += d[i];
l += d[i];
r += d[i];
if(l < 1)l = 1;
if(l > n)l = n;
if(r < 1)r = 1;
if(r > n)r = n;
}
if(l != r){
cout << -1;
return 0;
}
l -= p;
cout << l << " ";
for(int i=1; i<n; i++){
l += d[i];
cout << l << " ";
}
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... |