z4120's blog

By z4120, history, 5 years ago, In English

Upd3: Move to greasyfork (originally some dollar signs are converted to Latex), and add some known bugs.

Code: https://greasyfork.org/en/scripts/393157-cf-virtual-pretest

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.
  • When you register (virtual) for a contest, the script will prompt you to download the pretest.

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)
  • Fetching the pretest may infall invalidate the csrf token of the current page. In that case a reload would help.
  • When the user gets TLE, the "time taken" displayed will reveal that.
  • Even if the user definitely passes, the "???" may appear when the number of pretests is not definite on "running on test x".
  • 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)
  • Vote: I like it
  • +86
  • Vote: I do not like it

| Write comment?