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

+1 to this

My words precisely!!. And YES, LAST YEARS SET WAS <33333333333333

2 Likes

they can at least give some partial credits to other solutions with the relative error of 0.0000001

You should have used a higher precision (like cout <<fixed<<setprecision(30)<<endl; or use fixed point notation by using cout<<fixed<<setprecision(7)<<ans<<endl;

You should have used a higher precision (like cout <<fixed<<setprecision(30)<<endl; or use fixed point notation by using cout<<fixed<<setprecision(7)<<ans<<endl;

2 Likes

I agree with you that using relative error could have been a better decision. It made situation harsh with some participants. During testing, we used either fixed precision and didn’t think such issues can arise.

2 Likes

@d_skyhawk
It might be because you are using “ios_base::sync_with_stdio(false)”. It disables the synchronization between the C and C++ standard streams. By default all the standard streams are syncronized, and after that you have used cin as well as printf, that might be the error in this case.
Bdw Im not sure about this. This might be the case!!

3 Likes

@admin but our code gives correct answer for the testcase you provided in the other post. (Submission ID: 16117083). Please recheck the issue.

@admin - We even tried setprecision(15), still WA. It’s really disheartning to see similar solution getting AC when there is only difference of setprecision. :frowning:

This years questions were not testing the skills but the knowledge of the language a person use, getting a WA just because of precision difference is unjust. Ranklist would have been a total stranger to the current Ranklist.

3 Likes

I thing using ios_base disables the auto-sync after every IO operation. So if you use printf, only then it will explicitly sync with c and c++ stream and not after every cin/cout. (I may be wrong though)

@ak_1andonly I do agree, just spent hours debugging code rather than solving problems.

1 Like

Ya this icpc tested our skills in programming language and math and not algorithms how does make sure the right teams are selected to regionals ,this needs to improve in forthcoming years and getting wa for not typing cout<<fixed;was annoying and losing a place in regionals because of that is even more annoying to say the truth this contest might have discouraged many debues in icpc even icpcsc @admin

2 Likes

In one previous comment stating about 600solved the pblms ok where they ordered based on who found the algorithm first to say truth it’s no I even had a personal experience where our team got the algorithm first but my friends team got the code right before and the time difference was more than 3/4 hrs,and the even annoying part was interanal error which even reduced our confidence level .

Can someone please explain me how you derived that formula? Even after spending so much of time I couldn’t figure it out? @d_skyhawk @vijju123 @swetankmodi @rishi_07

1 Like

Its a bit of difficult derivation. The inspiration is, -

Total possible strings are {K}^{N}. Now, think of strings with block of 1,2,3… and so on.

You will get a formula which is is nothing but differential of x*{(1+(k-1)x)}^{N} . The first half isnt known to me, my teammate derived that - I resumed from this differential part and completed the formula for him :3

I derived a recurrence and solved it using generating functions. It’s like 2 pages long, you want me to post or someone with an easier solution would be willing to help?

Use fixed. And also change 1 to 1.0 everywhere

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 post yours.