yancouto's blog

By yancouto, history, 9 years ago, In English

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!

  • Vote: I like it
  • +17
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it -9 Vote: I do not like it

Why not test in Polygon instead of locally?

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    Me and some friends are trying to create a small online judge, is it possible to use Polygon to test the solutions instead of doing it locally?

    • »
      »
      »
      9 years ago, # ^ |
      Rev. 2   Vote: I like it -11 Vote: I do not like it

      No, I don't think Polygon is compatible with anything but CF, at least not in a way that isn't very convoluted. Anyway, I see multiple philosophical problems with it:

      • Why would you make ONE MORE? There are countless OJs already, what's the point? If it's to try and make something, then make something which doesn't exist yet.

      • Making an OJ that uses another OJ is half-assed — if you really want to do it, then make everything necessary.

      • »
        »
        »
        »
        9 years ago, # ^ |
        Rev. 2   Vote: I like it +19 Vote: I do not like it

        There aren't many good OJs in my language, and we're doing it as a project for our university, with hope to keep the coming freshmen training. I thought Polygon was meant to help with this kind of stuff, but if it's not we won't use it, of course.

        • »
          »
          »
          »
          »
          9 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          The language of the programming world is English, so people should train English as much as programming.

          But still, the fact that CF and Polygon are primarily English doesn't prevent you from using any language in problem statements, preparing problems in Polygon and making your own university's group in CF where you can use those problems, in any language you want. That's a simple solution.

          If you want to make your own OJ, go ahead, but I don't think it's worth it. Efficiency...

          • »
            »
            »
            »
            »
            »
            9 years ago, # ^ |
              Vote: I like it +6 Vote: I do not like it

            Can you answer me what is the difference between purple and red on codeforces?

            • »
              »
              »
              »
              »
              »
              »
              9 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              One has higher rating and different colour.

              Here's another one: what's the difference between a horse and a mole?

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If you need to use API , i personally prefer ideone APIs than HR's but you will need internet.

    Therefore, its obviously preferable to have offline judge. Here are few open source judges ,you can either use them directly or learn if you wish to create your own .

    Mooshak | DOMjudge | Codejudge | Aurora

    I can also pm you source code of my judge if you want , though its quite shit,its code its short,sweet & simple :P

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I agree with your point on offline solution, but topic starter said this above:

      is it possible to use Polygon to test the solutions instead of doing it locally?

      So I'm answering mostly this question.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Have you actually tried to used HackerRank API? Around 1 year ago I had tried, but it took a lot of time to actually get submission results. Uploading large files(upto 2MB) makes it even slower.

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I tried it in manual mode uploading some actual solutions there, it was more or less ok. I didn't try uploading big inputs though.