先看成一条链 for一遍找位置 在for一遍算答案 #include<algorithm> #include<iostream> #include<cstring> #include<string> #include<cstdio> #include<cmath> using namespace std; typedef long long LL; #define N 100010 int n; ; ],s[N<<]; i…
code: #include <bits/stdc++.h> #define N 100060 #define M 1000000 #define lson x<<1 #define rson x<<1|1 #define ll long long #define setIO(s) freopen(s".in","r",stdin) using namespace std; int n,num[N*10],ans=N,X0,X1;…