Userscript for showing only pretest verdict in virtual contest

Revision en9, by z4120, 2019-10-31 09:51:58

Upd: Fix a small bug. The old code for detecting contest phase is not sufficient.

Code:

code

Usage:

  • Just install the userscript. It will only one when you're taking part in a virtual contest.
  • Currently only works on the "My submissions" page (/contest/ID/my)
  • For testing, you can append ?always_show=1 to the URL.
  • Appending ?mock_pretest_count=1 will pretend that all problems have between 10 and 20 pretests.
  • It's recommended to download the number of pretest for a contest by visiting codeforces.com/contest/ID/my?force_get=1 before entering the virtual contest.

How it works:

  • Fetch every submissions
  • Check if there's any skipped/hacked solution such that there's no rejected test cases (like this) (then the number of pretest is the number of passed test of that submission)
  • Otherwise estimate the number by getting number of passed tests of solutions that fail on pretests/main tests of contestants.
  • After the number of pretest is calculated, it's easy to compute the pretest verdict. The number of pretest is stored for future usage, so it's necessary to download the data only once.

Known bugs:

  • Sometimes logging out fails for unknown reason. You can log out manually and then force-get the data.
  • It's not possible if there's not enough submission for that problem. (For instance, running the code says that there are at least 1 and at most 138 pretests for problem 566E)
  • If the user is taking part in a virtual contest, it's not possible to view the test cases of a submission. In that case it's necessary to log out the user.
  • Fetching every submissions just to get the number of pretests of the problems is slow. (This can be avoided by fetching only solutions in contest, given that there are currently ~20000 submissions but only 3585 in-contest ones for #566)
Tags pretest, virtual participation, api

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en12 English z4120 2019-12-01 13:32:15 14753
en11 English z4120 2019-11-10 10:50:22 1527
en10 English z4120 2019-10-31 10:01:17 41
en9 English z4120 2019-10-31 09:51:58 4454 Fix small bug, rewrite post
en8 English z4120 2019-10-26 18:28:19 130
en7 English z4120 2019-10-26 18:21:49 3536 Fix userscript
en6 English z4120 2019-10-15 17:00:39 16469
en5 English z4120 2019-10-07 19:48:43 244
en4 English z4120 2019-10-07 19:35:09 225 New workaround for a problem
en3 English z4120 2019-10-05 16:45:13 583
en2 English z4120 2019-10-05 12:48:27 18 Add code formatting
en1 English z4120 2019-10-05 08:03:32 2964 Initial revision (published)