#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int LL; typedef pair P; typedef pair LP; const LL INF=1LL<<60; const LL MAX=1e9+7; void array_show(int *array,int array_n,char middle=' '){ for(int i=0;i &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i>n>>m>>p>>q>>r; vector v1,v2; vector va(n),vb(m),vc(p),vd(q); unordered_map m1,m2; for(i=0;i>va[i]; for(i=0;i>vb[i]; for(i=0;i>vc[i]; for(i=0;i>vd[i]; for(i=0;i1){ z[2]=(z[0]+z[1])/2; a=0; for(i=0;i=0)a+=v2.size(); continue; } if(v1[i]>0){ if(z[2]>=0)b=z[2]/v1[i]; else b=-((-z[2]-1)/v1[i])-1; auto itr=upper_bound(v2.begin(),v2.end(),b); a+=itr-v2.begin(); }else{ if(z[2]>=0)b=-(z[2]/(-v1[i])); else b=(-z[2]-1)/(-v1[i])+1; auto itr=lower_bound(v2.begin(),v2.end(),b); a+=v2.end()-itr; } } if(asecond.first<<" "<second.second<