
可以先看一下大佬的:ButterflyDew 的博客
#includeusing namespace std; const int N=1e5+5; int a[N]; priority_queue < int,vector ,less > q; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; int ans1=0,ans2=0; for(int i=1;i<=n;i++) { q.push(a[i]); if(a[i] =1;i--) { q.push(a[i]); if(a[i]