void fun(int i,int &j,int &tmp){ int l =i,r=n; while(l<r){ int mid = (l+r)/2; if(f[mid] - f[i-1]>=m) r =mid; else l = mid +1; } j = r; tmp =f[j] - f[i-1]; }
Binary search in a few details:
1. First, find the binary condition is the sequence of monotone, seeking solvability this premise is most often moved downward as subscripts, where m is equal within the scope of the optimal solution, it should belong to the r update conditions
2.