Блог пользователя yancouto

Автор yancouto, история, 11 лет назад, По-английски

Hi! I'm trying to use Polygon to create some problems, but I'm having difficulties running the code on my machine (Linux, not Windows). I downloaded the Package on Polygon, and there are several scripts (do-all, gen-answer, ...), but no instruction on how to use them. I tried the Help page on the Polygon website, but the link is broken. do-all seems to generate all the tests, but I don't know how to test some code my friends wrote. If it wasn't clear, I have an a.cpp file, and I want to test if it is a correct solution. Is there something on Polygon that helps with that? Or should I do this manually? (And if so, how can I do it safely so some code doesn't mess up my machine?)

Any help or links would be great.

Thank You!

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

Why not test in Polygon instead of locally?

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Generally Xellos is right, but if it's your university project, this is how online judges work (you should write a script for that):

  1. User submits a solution
  2. The system compiles it in a binary executable. Also, every problem has its own checker — a program that validates the correctness of the output. You must have seen them in Polygon.
  3. Then the system runs the tests, one by one.
  4. A single run on one test case consists of the following. The executable is copied to a separate folder, as well as the input file. Then the system runs a line like ./solution < input > output, checking if the process exceeds the time and memory limit (I personally don't know how to do that). If the run is successful, the program outputs something in the output file. Now the checker starts his work. The exact usage can be found in testlib.h, it's something like ./checker input output juryOutput. When the checker finishes, you should check its exit code. If it's 0, the answer is correct, otherwise checker outputs something and returns the different exit code, the full list is also available in testlib.h.
  5. If all tests are passed, the solution is accepted.

Also you must take care of the security issues, that's one more thing I don't know how to do.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

If you haven't considered it yet I would propose using a Hackerrank API to test submissions, that might be a good solution unless you really want to invent everything on your own.