摘要:
将括号拆掉其实就是维护两个求和 任取一个作为根节点,做两次dfs 考虑使用贡献来更新答案 而第二次dfs考虑这条边权的影响 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2e5+10; c 阅读全文
摘要:
本题很容易看出在l和r中间和左边的都去l,其他都去r 之后我们可以二分出l在队列中的位置进行加减法,r同理 #include<iostream> #include<algorithm> using namespace std; const int N=1e5+10; int a[N],sum[N]; 阅读全文