# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
330054 | M_W | Labels (NOI20_labels) | C++14 | 67 ms | 5248 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>
using namespace std;
long long a[300300];
int main(){
long long N, minn = 1, maxx = 1, c = 0;
scanf("%lld", &N);
a[0] = 1;
for(long long i = 1, tmp; i < N; i++){
scanf("%lld", &tmp);
a[i] = a[i - 1] + tmp;
minn = min(minn, a[i] + c);
maxx = max(maxx, a[i] + c);
if(minn <= 0) c += 1 - minn;
if(maxx > N) c -= maxx - N;
}
if(minn + c != 1 || maxx + c != N){
printf("-1");
exit(0);
}
for(long long i = 0; i < N; i++)
printf("%lld ", a[i] + c);
}
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... |