×

# Wrong Answer in Chef and Way

 0 I am getting a WA in all except one test case in the problem CHRL4 (Chef and Way) when submitted to the grader The link to the problem is: https://www.codechef.com/problems/CHRL4 The link to my solution is: https://www.codechef.com/viewsolution/22138303 Can someone help me figure out the problem in this code? Thanks asked 30 Dec '18, 20:53 1●1 accept rate: 0% You can't compare 2 numbers by comparing their modulo with another number. Say you are comparing $500$ and $2$. Obviously $500 \gt 2$ but of you take modulo with, say, $499$. Then you will be comparing $1$ and $2$ and get $1 \lt 2$ but that does not imply that $500 \lt 2$. You are calculating min(street[max(0,i-k):i]) in your code and each value of street is taken modulo $10^9+7$ and the actual values of street can exceed $10^9+7$ easily. (31 Dec '18, 01:30) psaini724★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×2,169
×1,070
×16
×3

question asked: 30 Dec '18, 20:53

question was seen: 72 times

last updated: 31 Dec '18, 01:32