using System; /* * ================================================================================ * The code reads the input, computes partial answer and outputs the answer. * You only need to fill the indicated part in DivideAndConquer.CountOverSplit(). * ================================================================================ */ namespace Stocks { class Program { /* * Parse and solve all the test cases. */ static void Main(string[] args) { int numTestCases = Int32.Parse(Console.ReadLine()); for(int i=0; iub) continue; else //Find the rightmost j such that prefixSum[j]-prefixSum[i-1]<=ub for(int b=e-1; rightmost+1=lb) leftmost = m; else if(getSum(prefixSum,s,i,rightmost)=lb for( int a=m; a+1= lb) leftmost=(a+leftmost)/2; else a=(a+leftmost)/2; ans+= rightmost-leftmost+1; } /* ==================== Your code ends here ==================== */ return ans; } } }