Hello everybody,
I've been practicing for a while now with some old competitions and, as you know, many of them are not uploaded on any online judge so you have to test your solutions by yourself. For this purpose I use Codeforces Gym and prepare the problems in Polygon. The trouble comes from the fact that not all of the competitions provide model solutions. Most of them give the test data, but it is in the form of input-output files and from what I've managed to understand — Polygon wants a model solution to generate output files.
My question is : Is there a way to prepare a problem in Polygon by manually uploading the correct outputs of the tests and having no model solution?
Thanks in advance!
Unfortunately no. If inputs and outputs are small, you can just hardcore them into a model solution, if not... well, you can write a model solution as an exercise.
Ah that's sad. And well, the idea is to test my solution versus the correct outputs. So writing the model solution myself wouldn't make sense. Thanks for the quick response.
If you are only willing to test your solution then the easiest way is to do that locally, it takes one line in bash or cmd to do so.
You may use spoj or hackerrank, they are good for this purpose.
Well, you could always write a small script that would read some few lines of input and compare the variables to the input and print the answer. Of course, this is not very efficient but you can do it.
Example: Input is N, M, you could just write something like
A way to simplify this a lot would be to make add a unique identifier to the beginning of the test which your solution could ignore. Example, start input1.in file with the string "IN1". This string could be read by checker program which would print corresponding output. Writing a script to write this program for you is also quite straightforward.
Yes, that's a good idea for small outputs. Unfortunately for larger outputs the model solution would end up being like 10MB+ and I doubt that Polygon would accept it.
Well, as I said, just add a unique identifier to each of the test cases, and you just identify the input in your code using that, making code length much lesser..
Yeah, we will know what test is it. But how can we understand what to output?
You can locally add outputs to the end of inputs. Model solution will read (skip) input and then read-and-write output. You are practising so you will not use this hack during the contest.
That's actually very clever and will work. Thanks a lot!
You are welcome :)
It will not work with problems where you should read until EOF. I think you can fix it by adding some special character to mark the end of the input (and then writing the output).