Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long long maxi( int v, int tl, int tr, int l, int r) {
- if(tl>tr)return 0;//es ici rato
- if(r<tl||tr<l)return 0; //tuki exla ra segmentzec var sadzieelshi saertod ar shedis mashin amovdivar
- 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
- int tm=(tl+tr)/2;
- return max(maxi(2*v,tl,tm,l,r),maxi(2*v+1,tm+1,tr,l,r)); //vabruneb am oris maxsimums
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement