After asking the same question in comments section of the same problem and not getting any reply I am asking here.So,in seventh query of 1st eg. i.e. 3 0,since the value of c in this case is one so the person can only see colors in the range [0,2].So max. contiguous subsequence will contain only one dish with deliciousness 2.hence answer should be 2 ,but 3 is shown. Please clarify. asked 17 Dec '18, 23:44

The continuous subsequence can contain dishes with color other than [c−K,c+K] but since they won't be visible their deliciousness will not be added to the answer. 3c : Consider a person with colorblindness c. This person must choose an arbitrary contiguous subsequence of dishes on the table (possibly empty) and then eat all the dishes which this person can see. Chef wants to know the maximum possible total (summed up) deliciousness of the eaten dishes. The 7th query of example 1 has c = 1 and range as [0,2], if the whole sequence is selected as contiguous subsequence, it has 2 dishes with color in [0,2], hence they will contribute to the answer of the query as 2 + 1 = 3. answered 18 Dec '18, 01:25
