You are not logged in. Please login at www.codechef.com to post your questions!

×

# Not able to understand test case of colorblind feast

 0 I feel the answer of 2nd input should be 5 and last case of 1st input should be 2(this will be 3 if table is round).Please tell whether my understanding of question is wrong or anything else. Thanks asked 13 Dec '18, 20:06 1●1 accept rate: 0% Given sample case is correct,read the question again word by word. (13 Dec '18, 23:03) rajankur5★ Thanks for your help but still not getting where i am failing.The deliciousness values are 5,4,-3.Don't getting how they can sum up to give 6 (13 Dec '18, 23:48) its 4 -3 5 so 4-3+5=6 (14 Dec '18, 01:24) Thanks for your help but the last query of 1st input still concerns me. According to me,The colorblind can see only 0,1,2 and the middle one has colorblindness=3 so this will not be selected.As the table is straight so the maximum is possible only when the last food is selected (14 Dec '18, 08:43)

 0 i am also confused at the first sample case ... last query should produce answer 2 according to me answered 17 Dec '18, 17:30 -1●1 accept rate: 0% also i want to be clear wether we have to sum up the previous answer or take xor? bcoz in given sample case both are producing same output (17 Dec '18, 17:32)
 0 I thought the answer to the last query in first case was wrong too. But if you read the question carefully, you can see they mention "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". So what can we understand from this? This says you can choose any arbitrary contiguous sequence regardless of whether you can see all of them or not. It's not necessary that you can see all of them. Hope it clears your doubt answered 17 Dec '18, 20:02 3★lax_99 1●1 accept rate: 0%
 0 can someone plz post the approach to solve this problem. answered 18 Dec '18, 13:20 1 accept rate: 0%
 0 The sample test cases are correct. I agree there is a slight ambiguity in the problem statement though. The problem statement mentions that we have to take the value of c as the c xor previous answer for query type 1 and 2 only, however, as per the sample test cases we have to do this for type 3 too. As for my approach, I was only able to solve the first 2 subtasks. Here's how I did them - Subtask 1: I applied max sum subarray O(N) dp from here and used a deque as the data structure. Subtask 2: I applied square root decomposition. Instead of basing on the array, I based it on the range 0 to 2e9. I divided this into sizes of square root of 2e9. Whenever I got a c, I added the corresponding value of d to the appropriate block. Since in this subtask, d is always positive, we'll always choose the whole array as the solution subarray and eat all dishes that we can see. Thus this solution will work. answered 18 Dec '18, 13:38 865●2●14 accept rate: 10%
 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "title")
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×858
×63

question asked: 13 Dec '18, 20:06

question was seen: 490 times

last updated: 18 Dec '18, 13:38