| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 685482 | ngano_upat_na | Labels (NOI20_labels) | C++17 | 118 ms | 6680 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;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> v(n);
v[0] = 0;
for (int i=1; i<n; i++) {
int a;
cin >> a;
v[i] = v[i - 1] + a;
}
vector<int> t = v;
sort(t.begin(),t.end());
for (int i=0; i<n; i++) {
if (t[0] == 0) {
v[i]++;
}
else {
v[i] -= t[0];
v[i]++;
}
}
t = v;
sort(t.begin(),t.end());
if (t[n-1] < n || t[n-1] > n) {
cout << -1;
}
else {
for (int i=0; i<n; i++) {
cout << v[i];
if (i != n-1) cout << ' ';
}
}
} | # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
