#include #define all(vec) vec.begin(),vec.end() using namespace std; typedef long long int ll; typedef pair P; const ll MOD=1000000007; const ll INF=1000000010; const ll LINF=4000000000000000010LL; const int MAX=310; const double EPS=1e-9; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; int a[100010],b[100010]; struct BinaryIndexedTree{ vector bit; BinaryIndexedTree(int siz){ bit.assign(++siz,0); } int sum(int k){ int ret=0; for(++k;k>0;k-=k&-k){ ret+=bit[k]; } return ret; } void add(int k,int x){ for(++k;k>n; map mp; BinaryIndexedTree bit(n+1); for(int i=0;i>a[i]; mp[a[i]]=i+1; } for(int j=0;j>b[j]; } vector ans; for(int i=0;i