Someone Please explain the difference between these two solutions for Compression Algorithm

Our code gives the correct output for the above mentioned test case and even with all other test cases. Our submission with id, 16113398, gives WA during the contest. @admin, Please look into this issue. PS: While calculating the absolute error of our answer, consider the full answer with more than six places after the decimal as the expected answer and not the truncated one.

@swetankmodi please provide solution for compression algorithm.

I am not completely sure when we go this deep into decimals dear, I am sorry for that :(. But the reason you got WA is realted to absoute value being used, being rutheless ({10}^{-6} doesnt make sense to me since correct algo gives very near answers). I also feel that relative error should ahd been considered.

No, there’s either an issue with the judge (a bug) or it’s a feature (they’re checking absolute error and not relative error)

They intentionally checked absolute error, and trust me things get dicey when you aim for this high precision. Usually people tolerate an absolute error of 0.01, or relative error of {10}^{-6}, which make sense to me. Absolute error of {10}^{-6} was really, well, rutheless.

Yeah i said it might be a bug or even a feature. I’ve experienced this 5-6 times so I knew they wanted me to use python xD or play with c++ mechanics to get the correct result (exact)

1 Like

@swetankmodi but we used setprecision(10) still WA.


@rishi_07 I used setprecision 18 Still WA.

WA in python? Mind sharing your code if it’s allowed to?

I think 7 should give AC as well. Can anyone confirm?

@vijju123 Kindly check the photo posted by d_skyhawk in comment section. There upto 10 precision was used. Leave all of that aside, this is not the first time we are solving this type of precision related questions. 0.6lf works everywhere where 10^-6 precision is needed. I don’t understand why it failed here.

@rishi_07 , I checked it, and i know that 10 and 18 are giving errors. Before anything else, I want to know about 7.

Also, when they ask at long contest etc that an error of upto ${10}^{-6}$ is ok, they mean relative error unless stated other wise.

Well, I am not sure on WHY setter used absolute error when entire world knows that these issues arise from it, but idk, I mean…yeah idk why any1 would do that. I am sympathetical to the issue as well, but I dont think anything can be done about it.

It should give, but it didn’t. I’ve had a few cases as well where c++ failed and python got it accepted. One example is problem CHEFYODA from february or march 2017 long challenge. I don’t remember the other one’s. If you want I can search other problems?

No, i tried 7 too. (I tried 7 and 18.) One of my friends tried 6 but he has a different formula so idk if that’s right or wrong!

I usually use set precision 8 so I didnt face MUCH issues. Well, the point is right said by @swetankmodi , it should give AC but didnt. There are some problems where this happens- its not the first one- and not the last one either. But it should change if you ask me.

Yeah, I very well remember CHEFYODA because I wasted 5 days on that only to realize that my solution is correct :expressionless:


Holy shit @swetankmodi

Both the formula are exact same. Left one got WA. Right one AC.

I am talking about @d_skyhawk 's solution when he posted a screenshot where he used setprecision(10).

Dude both the formula are same. Just simplify one you will get the other. The first one was formulated by him and second one by me. We are teammates.