Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- vector<int> t;
- int get_p(int x) {
- int answ = 0;
- for (; x >= 0; x = (x & (x + 1)) - 1)
- answ += t[x];
- return answ;
- }
- int get(int l, int r) {
- return get_p(r) - get_p(l - 1);
- }
- void upd(int x) {
- for (; x < n; x |= (x + 1)) tree[x]++;
- }
- int main() {
- int n;
- cin >> n;
- vector<int> a(n);
- for (auto& e : a) cin >> e;
- t.assign(n, 0);
- return 0;
- }
Advertisement
Advertisement