题目大意:数据范围10W的双栈排序..双栈排序是啥呢?给你一个序列和两个栈,每次你可以把序列头入到两个栈的任意一个,或者把两个栈的任意一个弹出到最终序列,最后要求最终序列是有序的,求一种字典序最小的入栈方案
感觉自己应该是写不明白...日后如果有兴趣再来填坑吧..
先附上多年以前
vfk写的题解,非常详细
再附上我的代码...
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define N 100010
using namespace std;
int a[N],fan[N],pre[N],L[N];
int l[N<<2],r[N<<2],h[N<<2],cnt;
struct ppp{int mx,mxb;}W[N<<2];
ppp operator +(const ppp &x,const ppp &y)
{
ppp ret;
ret.mx=max(x.mx,y.mx);
if(x.mx>y.mx) ret.mxb=x.mxb;
else ret.mxb=y.mxb;
return ret;
}
void pup(int x)
{
W[x]=W[x<<1]&#