正文
增加 1 行删除 1 行
59 行未改动60616263646566676836 行未改动59 行未改动int cnt1 = ft.query(*prv + 1, *nxt - 1), cnt2 = cnt1 + d;ft.add(x, d);sum2 += calc(cnt2) - calc(cnt1);prv = prev(s1.lower_bound(x)), nxt = s1.upper_bound(x);sum1 += (calc(x - *prv - 1) + calc(*nxt - x - 1) - calc(*nxt - *prv - 1)) * d;if (tp) s1.insert(x); else s1.erase(x);}void upd2(int x, bool tp, bool flag = 0) {int d = tp ? 1 : -1;36 行未改动59 行未改动60616263646566676836 行未改动59 行未改动int cnt1 = ft.query(*prv + 1, *nxt - 1), cnt2 = cnt1 + d;ft.add(x, d);sum2 += calc(cnt2) - calc(cnt1);prv = prev(s1.lower_bound(x)), nxt = s1.upper_bound(x);sum1 += (calc(x - *prv - 1) + calc(*nxt - x - 1) - calc(*nxt - *prv - 1)) * d;if (tp) s1.insert(x); else s1.erase(x);}void upd2(int x, bool tp, bool flag = 0) {int d = tp ? 1 : -1;36 行未改动