# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
946232 | Captain_Georgia | Labels (NOI20_labels) | C++17 | 122 ms | 19800 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;
#define file \
freopen("in.txt" , "r" , stdin); \
freopen("out.txt" , "w" , stdout);
typedef long long ll;
const int mod = 998244353;
void test_case () {
int n;
cin >> n;
int dif[n - 1] , a[n];
a[0] = 1;
set<int> s;
s.insert(1);
for (int i = 0;i < n - 1;i ++) {
cin >> dif[i];
a[i + 1] = a[i] + dif[i];
s.insert(a[i + 1]);
}
if (s.size() < n || (*s.begin() < 1 && *s.rbegin() > n)) {
cout << "No\n";
return;
}
if (*s.begin() < 1) {
int tmp = 1 - *s.begin();
for (int i = 0;i < n;i ++) {
a[i] += tmp;
cout << a[i] << " ";
}
cout << "\n";
}
else if (*s.rbegin() > n) {
int tmp = *s.rbegin() - n;
for (int i = 0;i < n;i ++) {
a[i] -= tmp;
cout << a[i] << " ";
}
cout << "\n";
}
else {
for (int i = 0;i < n;i ++) {
cout << a[i] << " ";
}
cout << "\n";
}
}
int32_t main () {
// file
int TIME = clock();
int t = 1;
/// cin >> t;
while (t --) {
test_case();
}
cerr << "\nTime elapsed: " << (clock() - TIME) * 1000.0 / CLOCKS_PER_SEC << " ms\n";
}
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... |