HELP ON JULY LUNCHTIME

I have seen that in many cases when I try to solve a problem using brute force for getting partial marks for a problem, even if I write perfect code the judge shows me I am wrong in few test cases.
For instance, I was trying to solve the July lunchtime(2020) problem binary concatenation
and I tried to solve the problem using a naive approach, you know finding the binary value first then concatenating them and finding the answer using two loops and I checked every command and checked whether my program was running as expected and it was giving correct output but still codechef judge was telling me it was wrong…
can anyone tell me how i can handle such issues?

There must be some edge case that you are missing. My suggestion is to take a pen and paper and go through your code manually. You should meanwhile think of different test cases. For example, in this problem, the edge case of having only 1 cell was a unique test case.

You can write the perfect code for the bigger picture, but sometimes you need to think at a very basic level. Think outside the box, as well as think of the box (pun intended) :stuck_out_tongue:

Absolutely right and one of the most important thing about codechef contests is that it has awsm (if you are able to figure out ) or weird( if you are not able to figure out ) corner test cases…

1 Like

Thanks, I will thoroughly check for corner cases from now on…

fair enough! XD would be awesome if we find the corner case and would be weird if we dont :joy:

While edge cases are important, it’s important to note that sometimes your code might just have a bug. If I WA on a problem which I’m sure I’ve solved correctly, the first thing I usually do is read through the entire code again - each and every line. I’ve encountered 1 character changes changing a WA to an AC way too many times. It could be something as simple as a “<=” was actually meant to be “<”.

The second thing I usually do is spam small test cases which are easy to solve on paper, until I encounter a testcase where my code doesn’t work. If you have enough time, try coding a bruteforce to compare small, randomly generated testcases. This usually helps me.