CAKEDOOM - Editorial

Without any complex case examination you can do this: -If the first char is ‘?’, try every digit less than k here. Then just greedily on every next ‘?’ put the lowest valid digit. From these 10 at most strings return the lexicographically lowest.

2 Likes

@lazzrov A solution will need to replace any ‘?’ by either 0, 1 or 2… so no need to check for all values <k, but just these three values!
@admins… could you please give a hint as to why my submission fails : CodeChef: Practical coding for everyone
Thanks so much! :slight_smile:

3 Likes

Hi, can anyone pls help me in finding the test case for which my solution is failing?
CodeChef: Practical coding for everyone is my solution. Thanks in advance.

admin plz provide ur test cases

1 Like

There’s a trivial mistake in the editorial:

“K=2 can give a valid answer only when the length of the arrangement is even, else the first and last cherries will be of the same color if we choose alternative colors. So, print “NO” if the length of the arrangement is odd.”

N=1 is valid, even though it is odd.

3 Likes

can sme1 tell why my code is giving wrong ans i m still unable to find test case for which it fails:(:frowning:
http://www.codechef.com/viewsolution/1117745

I used recursive backtrack to get to the final solution if the initial lexicographically smallest solution is proved invalid. Doesn’t need to consider any cases. My Solution

Hi, can anyone pls help me in finding the test case for which my solution is failing? CodeChef: Practical coding for everyone is my solution. Thanks in advance.

Finally I managed to solve it! Thanks to the editorial team :smiley:
My test case was failing only for: n=1

Here’s my solution if anyone’s interested:

http://www.codechef.com/viewsolution/1128650

Code-http://ideone.com/h6wzu

@probsetter-can u tell me which cases of test file my code fails?..:?
thnx in adv…

Please Someone Help me and find a testcase for which my code will not work.

http://www.codechef.com/viewsolution/1130018

Can someone please explain why this is failing CodeChef: Practical coding for everyone

https://www.codechef.com/viewsolution/17554426

where am i wrong pls help

I am getting wrong answer. can anyone please tell me, which test case does my code fail?
I have tried all aforementioned test cases.

https://www.codechef.com/viewsolution/19006754

Any idea why this is not working?

https://www.codechef.com/viewsolution/22104718

Just a query : for the test case where K=1 and S=“5” , the output must be “NO”, right?
But I just observed that few solutions that got AC , have the output as “0” for the above test case.
Please explain?
P.S : Correct me if I am wrong :slight_smile:

1 Like

I am a little late to the party, but can someone please help me with what is wrong with my solution. I have read the editorial and fail to see what am I doing differently, which is causing WA for my solution. Please help :slight_smile:
https://www.codechef.com/viewsolution/23607275

You deal with the case K=2 in a wrong way. Try this test: 2 ??1?.

8 Likes

ah yes! My solution gave NO where answer is 1010. Thanks a lot :wink:

This is exactly how TESTER’S SOLUTION proceeds. But it is clear that once we find good fit for first question mark we don’t need to consider any further possibilities for it.

2 Likes