void minmax(int v[], int s, int d, int &minn, int &maxx) { if(s==d) minn=maxx=v[s]; else { int a,b,x,y; minmax(v,s,(s+d)/2,a,x); minmax(v,(s+d)/2+1,d,b,y); if(a<b) minn=a; else minn=b; if(x>y) maxx=x; else maxx=y; } }