Can someone please provide a clear explanation of the FAST solution for the question BRIBETR which came in February Lunch Time?

The editorial (https://discuss.codechef.com/questions/91951/bribetr-editorial )is very ambiguous. I could understand the solution that runs in O(N^2) but I am not able to understand what the editorial author wants to say in the faster solution. The Problem setters and problem testers code is a mess. No comments, no meaningful variable names. Maybe they should submit it for a CTF (Capture the Flag) cryptography contest.

4 Likes

@gonecase Can you explain the O(N^2) solution ?

Lol. Dude, while I do agree with many of your points, please try to bring out your points politely, without any sarcasm. These are helpful guys, and in my experience, have always boldly accepted and rectified there mistake. So till the time they act and rectify their mistakes and short-comings, we are morally obliged to be polite to them.

Coming to topic, I highly agree that problems setter and tester codes are quite messy. The first and fore most things they should do is to STOP (or at least minimize) the use of macros. I was checking editorial for DIGITSEP and was overwhelmed when I saw so many macro and definitions just in beginning.

The problem with macros is that, too many make it harder to keep track of them and understand the code. And code contains macros for too many things…data types, commands and even loops!!

Macros are good to use in code for contestants as it reduces the typing work one has to do, but they are not appreciated when you have to explain your code to anyone. It just makes it complicated and difficult to grasp. (Personal Opinion)

So yeah, if any editorialist/relevant person is seeing this, please stop (or at least minimize) the use of macros. I know it will increase the typing work for you, but it will help us assess your code thousand times better! :slight_smile:

If u feel any problem regarding the editorial then you first ask about this on comment section. I m agree that some part of this editorial is really difficult to get to the point for beginners, but if if someone is expert then he/she can easily grasp the logic easily. So try to think in your way and asked with me which line is giving you serious problem in this one

I agree, that’s true.

@gonecase maybe this will help you :slight_smile:

1 Like

@meooow Thanks a lot for taking your time out to give a clear explanation. It will help a lot of people.