### z4120's blog

By z4120, history, 3 years ago,

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

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)

• +86

 » 3 years ago, # |   0 Auto comment: topic has been updated by z4120 (previous revision, new revision, compare).
 » 3 years ago, # |   0 Auto comment: topic has been updated by z4120 (previous revision, new revision, compare).
 » 3 years ago, # |   0 While the current approach works well, it's slow. MikeMirzayanov Consider adding a query for the number of pretests to the API, if it isn't trivial to add the pretest feature to virtual participation?
 » 3 years ago, # |   0 Update: In the previous version the script doesn't work when the data is not fetched and the user is in a virtual contest. Now the issue is fixed.I think it's not possible to change HTTP-only cookies in JavaScript, so I have to log the user out.