So, I learned that it is possible to implement IOI-style tasks on Codeforces by implementing a grader program.
The gist of the problem I want to set is: Given x
, implement two functions encode(x)
and decode(code)
such that decode(encode(x)) == x
. This is a pretty standard class of puzzles.
Unfortunately, if the setter only makes one grader file, and the participant submits one file with the implemented functions, then it is possible for them to maintain a global map that just contains the actual exact answers for each x
, and then cheese the problem this way.
I believe the way to get around this is to run all the encode
steps in one run, and then run all the decode
steps on a second run. My guess is that I can do this by ticking the following "Advanced Settings" box on Polygon:
Is this correct? If so, could someone be kind enough to please share me an example of a Polygon problem that does this, so I can see what I need to implement?
Theoretically it is like this.
Remind yourself that when you tick "Is problem interactive", the pipeline becomes:
inf
in Interactor,inf
in Checker;ouf
andcout
) <==> Submission (STDOUT and STDIN);tout
) =>ouf
in Checker;When you tick "Run solutions twice" (alongside interactive), the pipeline changes slightly. It becomes:
inf
in Interactor (First Run),inf
in Checker;ouf
andcout
) <==> Submission (First Run) (STDOUT and STDIN);tout
) => Submission (Second Run) Input (STDIN);ouf
in Checker;When you also tick "Interactive second invocation", the pipeline again changes to:
inf
in Interactor (First Run),inf
in Checker;ouf
andcout
) <==> Submission (First Run) (STDOUT and STDIN);tout
) =>inf
in Interactor (Second Run)ouf
andcout
) <==> Submission (Second Run) (STDOUT and STDIN);tout
) =>ouf
in Checker;In any case the validator only checks the input given initially, not between the pipelines. The Interactor on both runs are the same Interactor, similar to how the submissions are the same as well.
So, what you want to do is:
first
to initial input to do this)second
to the input to do this)I hope this helps you well in your preparation (This is not very well documented sadly, all this info is found from trial and error)
Thank you SO MUCH!! This information is invaluable, I was so close to tearing my hair out---I couldn't find it anywhere else
I seem to be getting something like:
FAIL Call register-function in the first line of the main (registerTestlibCmd or other similar)
as a Runtime Error in my prep so far.My interactor begins with
registerInteraction(argc, argv);
Do I need to make it begin withregisterTestlibCmd(argc, argv)
as well? I (blindly) tried doing that, and it caused the output sent to the grader program it was interacting with to become weirdThis happens when you used a testlib function but didn't call
register*
in a source; it might be your interactor, validator, checker, or generator. I am guessing probably checker or generator.