Hi guys!
Problem Link : 1923C - Find B Submission : 248005674
My approach :
I have tried to calculate the minimum possible sum of subarray for every query range and compared it with actual sum of the subarray using prefix sum , My code passes sample test case but I'm unable to figure out why it is showing wrong answer for hidden testcases . Can anyone help me with this ?
Think about "1".
Could you please elaborate , cause i have handled the case where subarray size is 1
Occurrence of 1 in a segment is a special case.
Thanks got it
For the same problem I had wrong answer on test 3 in the 59831st excepted "NO" found "YES" and I did not know why it is wrong until now this is my submission 247968754
Think about "1"
try this case:
the answer should be NO
thanks
When a number in C is not 1, it can be 1 in your good array, when it's 1 it can be 2. Speaking in a "greedy" manner obviously. You can build an auxiliary array like that and compare the sums in the subarrays using normal prefix sums. You can check my implementation : 248017967