Y0 += B[B_idx][S[B_idx]];
Why don’t we add values from the F[][] array here as well? Also, won’t this recount pairs as F[i] is the number of letters less than c before i?
Y0 += B[B_idx][S[B_idx]];
Why don’t we add values from the F[][] array here as well? Also, won’t this recount pairs as F[i] is the number of letters less than c before i?
The editorials by @vijju123 hosted contests are much better and explanatory. Can someone help me understand this approach ?
hey guys why u’r making editorial so hard to learn??
How do we arrive at the formula Y=Y0−(B[i][c1]+F[i][c1])+(B[i][c2]+F[i][c2])
?
Thank you for the clear and informative editorial. It helped me understand and submit a valid solution. Cheers!
Needed little explanation on how we reach to that formula.
because the solutions provided are barely readable.
I wish the editorial to be more explanatory. Maybe by taking an example string and then showing the arrays B and F for that. Next time maybe
Hey, I have a query, If we change the letter at some jth position in the string then why are we not updating all the F[i][c] where i<j because due to the change at jth position there is a possibility that the updated letter at jth position becomes greater than then letter at some ith position but initially the not-updated letter was lower than the letter at that i’th position ?
Can anyone please tell why my code is giving WA for 2 test cases?
https://www.codechef.com/viewsolution/19349035
Please post solution link instead of entire code.
Hi! It indeed is {0, 1, 2, 1}. And code from editorial gives you the same result.
What you are missing is, when you change the character, you only consider impact on one size, you do not consider the impact on the other side. My solution is similar to yours. In case of doubt check CodeChef: Practical coding for everyone
If testers and authors are not competing why don’t they write more readable code?
And also we get editorials on time
Unluckily editorialist gave all editorials of questions I already solved… And editorials for questions I don’t know are not out yet !!!
Contest Lasts for 10 days and editorialist gets solutions from starting of contest… they why this much delay ? If you don’t have time then why to apply as editorialist ???
Please look into this
@admin
@mgch
@vijju123
Hi! My apologies for this inconvenience. The reason why editorials are delayed is that I had relocation due to internship and it definitely didn’t go as well, as I expected month ago when I applied to be an editorialist. I even had to live in a hotel for a while, because securing long-term accomodation here is a huge pain. Now when these things are settled, I do my best to prepare editorials as soon as possible. Please, be patient.
If editorials are unclear, please feel free to point me on particular parts which are difficult to understand and I’ll try to explain it in simpler manner.