CF757G Can Bash Save the Day? #include<bits/stdc++.h> #define RG register #define IL inline #define _ 200100 #define ycb (1<<30) #define ll long long using namespace std; IL int gi(){ RG int data = 0 , m = 1; RG char ch = 0; while(ch != '-' &a…
[CF757G]Can Bash Save the Day? 题意:给你一棵n个点的树和一个排列${p_i}$,边有边权.有q个操作: 1 l r x:询问$\sum\limits_{i=l}^r dist(p_i,x)$2 x:$swap(a_x,a_{x+1})$ $n,q\le 2\times 10^5$,强制在线.题解:学到了新姿势:可持久化点分树.我们先将询问变成前缀相减的形式,然后对于每一个前缀都用一个点分树来维护,不难在$O(\log n)$的时间内处理掉一组询问.现在问题在于如何…
题目链接: Codeforces757G 题目大意:给出一棵n个点的树及一个1~n的排列pi,边有边权,有q次操作: 1 l r x 求 $\sum\limits_{i=l}^{r}dis(p_{i},x)$ 2 x $swap(p_{x},p_{x+1})$ $n,q<=2*10^5$,强制在线 如果多次询问一个点到所有点的距离和,我们可以点分树解决,在点分树上每个点x维护点分树上x子树中的所有点到x的距离和及所有点到x父节点的距离和,每次询问往根爬容斥一下求和即可.如果没有修改操作我们依旧可…
I installed CentOS 7 with minimal configuration (os + dev tools). I am trying to open 80 port for httpd service, but something wrong with my iptables service ... what's wrong with it? What am I doing wrong? # ifconfig/sbin/service iptables save bash:…