qwexd's blog

By qwexd, 22 months ago, In English

MikeMirzayanov The event happened on the 5th, 8th, and 10th years of anniversaries. And it's going to be the 13th Anniversary a couple of months later, seems like it will happen according to the pattern. I wonder if the donation campaign will happen this year. (I want to get a badge)

UPD: petition to open fundraiser campaign to buy better servers MikeMirzayanov

Full text and comments »

  • Vote: I like it
  • +69
  • Vote: I do not like it

By qwexd, 2 years ago, In English

I've seen quite a lot of people asking about hacking but I couldn't find any guide in codeforces so I decided to make this blog.


What is Hacking?

$$$\ $$$ In a codeforces round, test cases might not be enough to judge your code. It's very normal since we can't expect setters to consider every single wrong solution to add new test cases. In other words, if your code gets Accepted during the contest, this doesn't mean your submission is necessarily correct. To avoid incorrect solutions that get Accepted due to the lack of enough test cases to judge during the round we use Hacking.

$$$\ $$$ There are two types of Hacking, one of them is after the contest and the other is during the contest; but the general idea of hack is providing a test case where you think someone's solution fails. The judge checks this specific test case you provided and determine if the solution actually fails. (Comparing outputs with actually working pre-made jury code to check if it gets Wrong Answer verdict, or simply checking if it's getting TLE/CE...) After Hacking Phase ends, all submissions run once again with new test cases that are added during the hacking phase. Note that if your solution is wrong and no one hacked you, it doesn't mean your submissions won't fail!


Hacking Types

During the Round (Div. 2, Div. 1 and mixed Rounds)

$$$\ $$$ Contests you can do hacks with this format are Div1, Div2, Global or Div1+2 contests. In this format, you can submit again to fix your mistake if you got hacked unless you locked your submission from the lock button. You can see the point for wrong/correct hacks from the right-down corner in the dashboard or any problem page. Successful hacks give 100 points while unsuccessful ones give -50 points. So if you cannot hack a solution, you will lose your points for nothing, so BE ABSOLUTELY SURE before doing something and think more.

  • Note that if you think you can solve more problems, I don't suggest you think about hacks, if you fail at doing hacks, you will only be wasting your time and decreasing your score. Hacking is the last choice if you don't feel any process at solving problems. Now let's look at how to see someone's code and submit a hack.

  • Only the latest Accepted submission counts, which means if you want to hack someone with multiple Accepted codes, you need to hack their latest Accepted code since other ones are useless as the penalty is also calculated from the latest Accepted code.

$$$\ $$$ To do hacks, you must go to the dashboard. After that, click the lock signature near your accepted solutions. Now you are ready to hack! Note that you must get Accepted before doing hacks in this problem.

  • Be careful! When you lock your solution, you won't be able to submit your locked problem again, so if you get hacked or find an edge case, you won't be able to submit again to the problem.

  • Tip: If you (or someone else) lock your solution, your score will be seen with bold font at the standings.

$$$\ $$$ After locking your solution, note that you won't be able to hack everyone. This means that you can only hack your roommates.

  • Oh wait, what does roommate mean? At the beginning of contests, the system will assign you to a random room. You can see your roommates' standings from the Room Section. If it doesn't appear, go to Dashboard and now you can see it.

$$$\ $$$ In the standings of the room section, you will see the points of your roommates and if you double-click or ctrl+click on a passed solution, you will be able to see the image of the solution code. That's because you must not just copy-paste the solution to gain time for stress-testing and brute force all solutions. Under that, you will see the Hack button and can send tests according to the constraints. If it turns out to be too long, you can send a generator code.

$$$\ $$$ If your hack is not suitable for the constraints, you will get the verdict 'Invalid input'. If your hack gets the verdict 'Unsuccessful hacking attempt' if the defenders' code works correctly against your input, and finally gets 'Successful hacking attempt' if the code gives TLE or gives a different answer from the jury answer or anything else other than Accepted.

  • Tip: Convert the image to text by typing while trying about the correctness of a solution. You can think about edge case and try it by your eyes but it can be a little dangerous so you can make a mistake (unless you are NOT ahmet23).

note: Sometimes you can't make hacks if pretests are too strong or the solution is too obvious. In addition, hacks can really be a lottery. One or more of your roommates' solutions must be wrong to hack. So I strongly suggest you look into more problems if you are able to solve them.


After the Round (Div. 3, Div. 4 and Educational Rounds)

$$$\ $$$ There is a 12-hour open hacking phase after the contest ends where all users can look at others' submissions and try to find a counter case to their solution and hack them. You don't get extra points for these hacks. After the open hacking phase ends all submissions run again with the new test cases that have been added to tests during the open hacking phase. Contests with this format are Div. 3, Div. 4 Rounds, and Educational Rounds.

$$$\ $$$ During a 12-hours hacking session, you will be able to see everyone's code, unlike during-contest hacks. You just can go standings page and click any solution you want. Now you can see the code as text and copy-paste it to your local computer and start some experiments on that lab rat as you wish :).

Note that you don't need to get AC at that problem to do hacks as these hacks won't give you any score.

Now let's touch on some tips to do hacks.

  • First, notice that you can sort solutions by running time. This gives the advantage to find slow codes. If the problem is about optimizing time or something else (you can understand it by problem), you can generate a test that causes worst-case and brute-force over slow codes and submit hacks one by one.

  • Second, can find an edge case that doesn't appear at pretests and brute force over random suspicious codes. Generally, ratings below the 1500s are doing mistakes commonly (it maybe can be a little unethical, but true) so you can look to especially their codes.

  • If the solution to a problem requires double or something else that might cause a lot of trouble to people and if the pretests are weak, it can be easy to hack. You can use the technique above.


Thanks to tolbi and burak for helping me with preparing the blog.

Full text and comments »

  • Vote: I like it
  • +166
  • Vote: I do not like it

By qwexd, 2 years ago, In English

This blog is to list common bugs/suggestions/complaints for MikeMirzayanov. Share your ideas in the comments so I can add them to the list.

  • Make offical dark mode.

  • Add discussion section for each problem in the editoral.

  • Add unrated registeration.

  • Make upvotes and downvotes changable.

  • Rename "friends" to "followers".

  • Add report user option.

  • Add the dislike button([dislikes:1]).

  • Change hacked code verdict to "Verdict"(hacked) instead of just "Hacked".

  • Problem submission syncing (i.e. if you solve a problem in a mashup or a div 2, your submission will show up in the div 1 version of the problem as well).

  • Seperate show tags and show problem rating options for problemset.

  • An option for excluding tags when filtering problems (for example, let's say I want to do some DP problems, but I don't want greedy problems that also have DP solutions to show up, or let's say I want to practice problems from a certain difficulty, but I don't want to see any geometry problems).

  • Make offical rating change predictor.

  • Allow ending on-going virtual contest.

  • Remove penalty on all samples.

  • Add personal hacking history.

  • Rename "blog" to "article", "publish", "post" or something.

  • Make the folder icon in the catalog clickable so that we can collapse certain columns while searching.

  • In Fav. Blog Entries Option, blogs should be collapsed by default so that we can see multiple favorite blogs at one time otherwise it takes a lot of scrolling to see the next fav. blog.

  • Make comment replies collapsable.

  • Paginated comments sections. (so that blogs with a large amount of comments are actually scrollable on mobile)

  • Add an Option to show only solved problems in the problemset. (not hide solved problems only.) (Because say you want to see all problems you have solved in fft.)

  • Add an Option to filter gyms with solved problems.

  • Allow removal / hidding of problems in the Last Unsolved list (section of PROBLEMSET).

  • Add "hide if participated by any of the given member-list." option on the gym.

  • Add a feature to hide tags while preparing contest in gym.

  • Allow changing profile picture to the default profile picture.

Full text and comments »

  • Vote: I like it
  • +365
  • Vote: I do not like it