DEFACING - Editorial

@anton_lunyov >> I got what you have written, but I took too much time to understand :frowning: Thats why I was in the phase of sadness as to when will I be able to write such a code :smiley:

Can anybody tell me why my


[1] is resulting in Wrong Answer ? I have used the same approach as described in the editorial.


  [1]: http://www.codechef.com/viewsolution/1745718

Try this test:
4987565 14398964
Your answer is 9989889,
while the correct one is 9989989.

My code is resulting in wrong answer …

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

I have tried every test case given in posts and problem…
working correctly…

what is that I am missing ?

Your program fails at the very first test from here.

Did you write this just for fun:
“I have tried every test case given in posts and problem…”
?

words are encouraging !!!
Still I stand to my words…
“it satisfies the cases that you gave…” (not fun this time !!!)
run it with gcc compiler… and see

is there a problem with “memset()” … because locally it is working fine !!!

Haha. Very funny. You’ve fixed the bug and changed the submission ID to that passing posted test cases.

Now the failing test is
1042216 1815366
The answer is 1098898
while your answer is 1798898,
which is completely impossible since we can’t make 7 from 0.

I’ve also added it to the above post with tricky test cases.

what is with initial values of prefix_equal and prefix_less??

http://ideone.com/VRvkWc
this is my code for the problem.It is returning correct solution for every test case(mentioned).
Someone please tell me what is wrong with this because every time I submit it shows wrong answer

The only correct solution posted by me is copied.

7347946 12524098 --> 10999998

1 Like

I think this is correct. If wrong what is correct solution??

You last submission return different answer. You should indicate the submission ID at codechef instead of pasting the code to outside resources.

1 Like

http://www.codechef.com/viewsolution/1790134
This code is producing right result on my machine(for the above mentioned case as well). Sorry to sound cynical but it is truth

19 hours the last submission was 1784916 and it produces wrong answer.
The test for the new version is 2926618 18735670.
The answer is 12988898.

1 Like

For a line like this

value    707496
max    10257511

why the answer “10089998” is wrong?
Your test give me “10099989”, but the last “6” cannot become “9”.

we add the empty slot after 707496:


 707496 
10257511

Then we can get 10099989.

I have written my code for this problem. Can you please tell me whats the format of the program. I mean it is not specified how the input will be taken and how the output should.
My code read the file which is in the folder of compiler and gives output in a file. But tester going to know this. He have to change the name of the file according to his testing computer.

So please help me out. How the submission is done.
Thanks in advance.

@syker, you have to perform all the IO from/to stdin/stdout. Just like the normal way you code.
You can check few samples by going on anyone’s profile page and then hitting any problem and then the corresponding solution.

1 Like

@anton_lunyov
Excellent problem…my first attempt at codechef and I am enjoying every bit of it. :slight_smile:

This is the latest version of solution I have developed:
http://www.codechef.com/viewsolution/1864293

It gives a correct output for all the 12 test cases given in problem, 9 tricky cases added by you plus two more given in other comments.

I know, it doesnt mean it is a correct solution but I am unable to understand why I am still getting wrong answer.

I have used my own logic, havent looked at your solution yet, I want to figure out the entire solution on my own. Can you can provide some more test cases, which will help me in figuring out the bug on my own. I tried to create test cases on my own, by using random number generator and all, but got correct answers for all of them. So, if you have some more test cases, it will be great

P.S. : I dont expect you to go through my code as it can be tricky to understand the logic :stuck_out_tongue: