做法,线段树线段树维护一个等差序列。懒标记:记录当前的k值,记录k值所在位置 #include <iostream> #include <cstdio> using namespace std; #define int long long const int N = 200010; struct Node { int l, r, sum, add, t; }tr[N * 4]; int n, m; int w[N]; void pushup(Node &c, Node &a, Node &b) { c.sum = a.sum...