模板,按照题意模拟即可,记得讨论清楚边界 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 2e5 + 5; int __t = 1, n, q, op, l, r, x, k; void solve() { vector<int> a; cin >> n >> q; for (int i = 0; i < n; i++) cin >> x, a.push_back(x); ...