正向删除 逆向合并
if else分支特判写好
https://codeforces.com/contest/722/problem/C
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
ll n,a[maxn],p[maxn],res[maxn];
ll pre[maxn],sum[maxn],vis[maxn],tmp,maxx;
int find(int x){
if(x==0 || x==n+1)
return -1;
return pre[x]