分往左走和往右走两种情况讨论即可,输出可以用前缀和优化至o(1)。 #include<bits/stdc++.h> #define int long long #define double long double #define x first #define y second using namespace std; typedef long long LL; typedef long long ll; typedef pair<int, int> PII; const int N = 3e5 + 10; const int M = 1e3 + 10; int mod...