RBTREE - Editorial

One of the test case is accepted and the others are not. Can any one tell why ?

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

1 Like

Getting all cases I could think of right. Submitted 11 times… still couldn’t get any points.
Any help would be appreciated. Also no issues as reported in earlier comments.
My solution:
http://www.codechef.com/viewsolution/5419500

1 Like

Can you inspect this solution also. Only one subtask was giving WA and rest all were accepted. Can’t figure out the problem in this.
http://www.codechef.com/viewsolution/5345645

1 Like

Cannot figure out the problem.Please inspect the solution.
Solution

1 Like

Here it is!!

Fully commented solution:
link text

3 Likes

Getting all cases I could think of right. Submitted 3 times… still couldn’t get any points. I checked against all test cases in above editorial but working for all and giving right answer but on submission getting WA. Any help would be appreciated.
http://www.codechef.com/viewsolution/5403607

Hello all

If someone need setter’s solution here is the link…

Can someone help me with the 2 test cases where my code fails to give the correct answer?
My solution: CodeChef: Practical coding for everyone

It would be really helpful.Thank You.

This link is for different problem, is it a mistake?

Please tell me what am I doing wrong - your code return 2 for input from problem statement - yepUD3 - Online C++ Compiler & Debugging Tool - Ideone.com

yeah !! I am also inspired with that cool problem authored by lalit kundu :smiley:

I am so sorry for that. Here is the correct link.
http://www.codechef.com/viewsolution/5336214

It prints 2 as an output for problem statement example - see here APdHId - Online C++ Compiler & Debugging Tool - Ideone.com

I didn’t test it, but why in is of length 2? try to make it 5… Ok, and I tested it and this is first problem (same link), it also seems, that you print additional empty lines between the outputs…

Same as @thegreatheisenberg above - use a[5] instead of a[2], in C, string is ended with '\0' and it’s a good habbit to alocate a little more memory than you need in contest programming…

I tried using this method, but WA!
can anyone fix this?
http://www.codechef.com/viewsolution/5423114

For input:

14
Qb 1 2
Qr 1 2
Qb 1 4
Qr 1 4
Qi
Qb 1 2
Qr 1 2
Qb 1 4
Qr 1 4
Qb 4 5
Qr 4 5
Qi
Qb 4 5
Qr 4 5

your output ends with

1
2
1
2

ans should end with

1
2
2
1

Okay, so I printed an extra line after each output because earlier in the sample output it seemed to me that they wanted me to print an extra line due to their formatting, now they corrected it (and it seems the online judge ignores extra line between outputs).
Secondly, it worked after changing in[2] to in[3] (no need for 5), but I don’t understand the logic behind this. Is it because ‘in’ needs to take a null character at the end so I need to provide extra space for that? If that’s true then why did the program run correctly on my pc before?
Thanks for your effort.

Thanks for the help.

It returns 1 for input

1
Qr 12 28