摘要:
D - Maximum Sum of Products 区间DP 可先算出不反转任何子区间的答案 \(sum\) 再利用 区间DP 算出反转 \([l,r]\) 的话会比原来的答案多多少,记为 \(f[l][r]\) 转移:\(f[l][r]=f[l+1][r-1]+a[l]*b[r]+a[r]*b 阅读全文
摘要:
树状数组 逆序对 #include <iostream> #include <cstring> #include <algorithm> #define int long long using namespace std; const int N = 5e5 + 10; int tr[N], ran 阅读全文