#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef unsigned long long int ull; typedef long long int ll; typedef pair pll; typedef long double D; typedef complex P; #define F first #define S second const ll E=1e18+7; const ll MOD=1000000007; templateistream & operator >> (istream &i,pair &A){i>>A.F>>A.S; return i;} templateistream & operator >> (istream &i,vector &A){for(auto &I:A){i>>I;} return i;} templateostream & operator << (ostream &o,pair &A){o<ostream & operator << (ostream &o,vector &A){ll i=A.size(); for(auto &I:A){o<vector & cset(vector &A,T e=T()){for(auto &I:A){I=e;} return A;} const int SIZE=300500; namespace Monotone_Minima{ vector am(SIZE); //argmin(cul(i,*))<=argmin(cul(j,*)) for(i void argmin(function cul,int n,int m,function comp=less()){ for(int i=0;i>=1){ for(int j=0;j=0 && am[j-i]!=-1?am[j-i]:0),r=(j+i vector divide_and_conquer(function cul,int n,T e=T(),function comp=less()){ vector ret(n,e); for(int i=1;i(fnc,min(j,n-i),j,comp); for(int s=0;s>n; vector A(n),X(n),Y(n); cin>>A>>X>>Y; function cul=[&](int i,int j){i--; return i ans=divide_and_conquer(cul,n+1,0); cout<