Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// CF contest
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- long long n, a[200000] = {}, i, b;
- cin >> n;
- cin >> b;
- a[1] = 0;
- a[n] = b;
- for (i = 2; i <= n / 2; i++)
- {
- cin >> b;
- a[i] = max(a[i - 1], max((long long)0, b - a[n - i + 2]));
- a[n - i + 1] = b - a[i];
- }
- for (i = 1; i <= n; i++)
- cout << a[i] << " ";
- cout << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement