F n+1颗线段树写法供参考 每个数组用一颗线段树维护min,再另开一颗线段树维护前i个数组的min 代码如下 #include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define lowbit(x) x & (-x) const int N = 1e5 + 10, M = 1010, mod = 998244353, inf = 2e9; const double eps = 1e-9; typedef pair<int, int> pt; ...