RBTREE - Editorial

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

It prints 11 and 10 for

2
Qb 999999999 1000000000
Qr 999999999 1000000000

and it should be 10 and 11…

It prints 22 and 23 for

2
Qb 999999999 1000000000
Qr 999999999 1000000000

first subtask has x and y less than 1000

I missed from your comment, that you are interested only in subtask 1, sorry…

I know it’s easier to ask, but please read the forum before asking. It’s not working for hH1YKh - Online C++ Compiler & Debugging Tool - Ideone.com , and it mentioned already…