Got 70 but not 30 in ELOMAX During Contest

When i made another Submission, i got Runtime Error Instead Of TLE.
My Submission getting RE During Contest-Click Here

That equality sign is the reason for this too? and if yes then what’s the harm in adding equality sign?

There is one CF blog, i dont have the link right now, it says multiple times to never use equality in sort comparator. I dont know the actual reason, maybe it is that the function ends up having many comparisons leading to the TLE or RE(maybe)

1 Like

But if we add/remove equality sign, i dont think no. of comparisons will increase/decrease.
Moreover, My code is Running well for Second Subtask, which have larger Constraints.

@zephxr After searching for 1 hour, i finally found the blog-Link. Hope after reading the blog, you would never make this mistake. Another Link

1 Like

And if you actually want to know the reason , this blog-Link :stuck_out_tongue:
“In C++, comparator should return false if its arguments are equal.”

1 Like

I will never forget This Line Now:

In C++, comparator should return false if its arguments are equal.

Thank You So Much @unsung_heroes. Today i learned Something new.

2 Likes

Thanks For this.

1 Like

Can you pls help me @zephxr? I could not score anything in this problem. Can’t figure out my logical problem.
Here is the link with my logic and answer.

when is the editorial going to arrive. Or its out already?

@debadri16 Why are you sorting the matrix column wise(To calculate Rank, Right?) we should to sort the matrix row-wise as our in our input Rows are represented by players and columns are represented by months.

No its not out yet!

I wrote wrong. I am sorting row-wise for each month(column). you can see in my solution.

You are sorting whole matrix at once!
Try to take all the elements of all rows column wise in a vector and then sort that vector and then calculate rank of each player.(Thats how i did and that is easy )

I think there’s a problem in your sorting of matrix.

Same thing bro, I tried. The problem is somewhere else. Can’t figure out :confused:

This is not fair. Contest is ended and editorial for problem ELOMAX is not provided yet.
I think @admin or @akash_adm should look into this.

1 Like

Hey, sometimes editorials take some time, especially the good ones. There are some stages involved in editorials: understanding the solution, writing them, submitting the solutions, admin reviewing the editorials, moving them from a private discuss page to the public one, etc. I’m sure that the editorialist and the admin are doing their best in making the editorials available as soon as possible. Meanwhile, you can look at other solutions, or ask questions on Codechef Discuss to help clear your doubts. Thanks for your patience :slight_smile:

1 Like

Thanks for notifying :+1:

1 Like

By The Way i got to know what was the problem in my code(Equality Sign in comparator Function).But Can i say the test cases were weak for Second Subtask such that they passed even in presence Of Equality Sign In Comparator Function?

@akash_adm

Test cases are usually not designed to target specific features of any language . Test cases are simply designed, so that sub-optimal and incorrect solutions, be it any language, don’t pass, to the best of a setter’s efforts. When thousands of submissions are made to a problem, it may happen sometimes, that some solutions pass, even though they have minor bugs. One problem can have many different implementations. Efforts are put more into preventing sub-optimal and incorrect ones from passing, as opposed to trying out every possible minor bug that a user can make, over many possible implementations. It’s unfortunate that a buggy solution passed, but that doesn’t necessarily make the test cases weak.

1 Like

Buggy Solution

My Buggy Solution Didn’t pass fully,Thats why I created this Thread In the First Place!

1 Like