Advertisement
sandro1234

Untitled

Nov 27th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. long long maxi( int v, int tl, int tr, int l, int r) {
  2. if(tl>tr)return 0;//es ici rato
  3. if(r<tl||tr<l)return 0; //tuki exla ra segmentzec var sadzieelshi saertod ar shedis mashin amovdivar
  4. if(l<=tl&&wr<=r)return t[v]; //es imito ro tu es segmenti razec exla var shedis sadziebelshi mtlinad mashin xo pirdapir amisi pasuxi mawyobs
  5. int tm=(tl+tr)/2;
  6. return max(maxi(2*v,tl,tm,l,r),maxi(2*v+1,tm+1,tr,l,r)); //vabruneb am oris maxsimums
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement