# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301169 | beso123 | Labels (NOI20_labels) | C++14 | 36 ms | 1664 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 int long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
int n;
int a[100005];
main(){
cin>>n;
a[1]=1;
for(int k=2;k<=n;k++){
cin>>a[k];
a[k]+=a[k-1];
}
int ad=0;
for(int k=1;k<=n;k++){
if(a[k]<0)
ad=max(ad,abs(a[k]));
}
for(int k=1;k<=n;k++)
a[k]+=ad;
int mx=0;
for(int k=1;k<=n;k++){
mx=max(mx,a[k]);
}
if(mx!=n)
cout<<-1;
else{
for(int k=1;k<=n;k++)
cout<<a[k]<<' ';
}
return 0;
}
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... |