Is there any way to get the number of pretests of a problem? (unfortunately, according to the API help page there arehthere's no such option, and there's also no way to get it through the GUI (because if there's one, I would be able to figure out how to do it with code)
I tried using this code
(fetch every submissions, check if there's any skipped/hacked solution 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)
However there is a problem:
- It's not possible if there's not enough submission for that problem. (For instance, running the code above says that there are at least 1 and at most 138 pretests for problem 566E)
And some problems that have workaround:
- It's slow. (This can be partially avoided by fetching only solutions in contest, given that there are currently 19528 submissions but only 3585 in-contest ones for #566; and store fetched result with
GM_getValue/GM_setValue
orGM.getValue/GM.setValue
— so it's necessary to download the data only once for each contest) - The code will not work when there are cheaters (for example this submission is listed as "skipped" but there's a "wrong answer" test, however it's not because the user submit another one but it's likely because the user cheated, according to https://codeforces.net/blog/entry/58038) This can be work around by fetching the submission page to see if there's any failed test (there's no indication in the API result.
Background: I'm trying to fix the userscript that displays only pretest verdict in virtual participation. A huge bug is that it assumes that double clicking an entry in the standing table will show [pretests]
or [main tests]
depends on whether the test is a pretest or a main test. However it isn't the case, as can be seen in https://codeforces.net/contest/566/standings (turn on "show unofficial", then double click the entry for problem C of user hogloid
, you can see "Wrong answer on test 1 [main tests]", which is obviously wrong.