Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define DAU std::ios::sync_with_stdio(false); fin.tie(0); fout.tie(0);
- #define PLEC fin.close(); fout.close(); return 0;
- using namespace std;
- using ll = long long;
- ifstream fin("ou.in");
- ofstream fout("ou.out");
- vector<ll> v, p;
- ll rez;
- int n, nrc, nrt, x, y;
- int main()
- {
- DAU
- fin >> n;
- v = p = vector<ll>(n + 2);
- for (int i = 1; i <= n; ++i)
- {
- fin >> x;
- nrc = min(n - i, i - 1);
- nrt = 2 * nrc;
- nrt = min(x - x % 2, nrt);
- nrc = nrt / 2;
- if (nrc)
- {
- p[i] = x % nrt;
- y = x / nrt;
- v[i - nrc] += y;
- v[i] -= y;
- v[i + 1] += y;
- v[i + nrc + 1] -= y;
- }
- else p[i] = x;
- }
- v[0] = 0;
- for (int i = 1; i <= n; ++i)
- {
- v[i] += v[i-1];
- rez = v[i] + p[i];
- fout << rez << ' ';
- }
- PLEC
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement