# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285697 | NintsiChkhaidze | Labels (NOI20_labels) | C++14 | 247 ms | 9312 KiB |
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 fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define f first
#define s second
#define ll long long
#define int long long
#define mod 1000000007
#define N 300005
using namespace std;
int a[N],X[N];
main (){
int n;
cin>>n;
for (int i=1;i<n;i++)
cin>>a[i];
int minn = 0,maxx = 0,m = 0;
for (int i=1;i<n;i++){
m+=a[i];
X[i] = m;
minn=min(minn,m);
maxx=max(maxx,m);
}
if (maxx - minn != n - 1){
cout<<-1;
return 0;
}
X[1] = 1 - minn;
for (int i=1;i<n;i++)
X[i + 1] = X[i] + a[i];
for (int i=1;i<=n;i++)
cout<<X[i]<<" ";
}
Compilation message (stderr)
# | 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... |