Ternary Search → Pay attention Before contest Codeforces Round 941 (Div. 1) 43:50:29 Register now » *has extra registration Before contest Codeforces Round 941 (Div. 2) 43:50:29 Register now » *has extra registration → Top contributors...
Hello! For finding the minimum with Ternary Search we nead a function that respects this conditions : for all a,b with A ≤ a < b ≤ x, we have f(a) < f(b), and for all a,b with x ≤ a < b ≤ B, we have f(a) > f(b). Is there an algorithm ( also running in lo...
Codeforces - New Bakery Codechef - Race time Hackerearth - Rescuer Spoj - Building Construction Codeforces - Weakness and Poorness LOJ - Closest Distance GYM - Dome of Circus (D) UVA - Galactic Taxes GYM - Chasing the Cheetahs (A)
Ternary Search for Minimum Bounding Square By Ahmad_Elsagheer, 7 years ago, Problem: Given n points in x - y plane, it is required to find the minimum area for a square that encloses all the points. For sure, some points will lie on the square sides in the optimal solution...
So after getting it accepted, I tried reading accepted codes of other people and I found a nice way to do it. since many of the best coders in codeforces (includingtouristandErrichto) didn't use this while solving626E - Simple Skewness, I think many people don't know about it!
Is there anything wrong using this approach for ternary search on integers? while(R-L>=3){m1=(L+L+R)/3;m2=(L+R+R)/3;// say we're looking for the maximumif(f(m1)>f(m2))R=m2;elseif(f(m2)>f(m1))L=m1;elseL=m1,R=m2;}ans=inf;for(i=L;i<=R;i++)ans=min(ans,f(...