MikeMirzayanov's blog

By MikeMirzayanov, 9 years ago, translation, In English

Hello Codeforces.

Just a reminder about something most of you know. Polygon is a service to prepares programming problems and contests. It is usually used to prepare problems for olympiads/programming contests but it is also often used to prepare educational content. It is located at https://polygon.codeforces.com/ and is open to everybody.

I have recently found out that it's been more than five years since the creation of Polygon. It's high time to summarize the experience we've accumulated.

I first publicly spoke about Polygon in a narrow circle of Russian teams' coaches on ACM-ICPC World Finals in 2009. I cannot say that everybody was enthusiastic about the innovation. Some people were openly skeptical about such system's viability and relevance. After 5 years on the ACM-ICPC finals in Ekaterinburg Oleg Hhristenko (snarknews) said that in his opinion, the creation of Polygon is more of my achievement than Codeforces. Of course I was surprised but I said so to Polygon :-)

When I started working on Polygon (in the autumn of 2008), I understood very well how much this system was needed. By that time I had already been an experienced writer of many problems. The infinite number on highs-school Saratov Olympiads and ACM-ICPC Subregionals. My problems were on the All-Russian Team School Student Olympiad in Programming, the Russian National Olympiad in Informatics (for High-School Children), the ACM-ICPC NEERC Regionals, the TopCoder Open Finals and many other places. In most cases the problems were developed in some VCS (e.g. SVN) everything was structured by some half-formal unspoken naming rules.

I am going to give you some thesis statements on why it is good to use Polygon and bad not to.

1. Polygon protects from errors

Polygon is full of automatization, self-checks and verifications. Some examples:

  • it is hard to make a misprint in a sample input/output and forget to actualize it after the tests are changed as it is inserted automatically and the answer is generated by Polygon using the model solution;
  • it is hard to leave a non-compiling solution in the archive (even experienced teams like ITMO regularly leave the solutions on Java in the archive where the name of the class doesn't match the name of the file);
  • it is hard to forget to make the first test the statement test, Polygon would warn you about it;
  • it is hard to write a generator that is initialized from time and thus it prints different tests on consecutive invocations (i.e. not stable), Polygon will run the generator a couple of times with an interval of one second and check if the tests match.

2. The archives (packages) of the Polygon problems are uniform and machine-readable

It's striking that the olympiad community hasn't standardized a method to distribute problems. The problems from Polygon have a uniform and logical way of organizing files and are machine-readable. File problem.xml contains not only the basic meta information like memory limits, but it also has everything you are going to need for the continuing work at a problem. Here are some examples:

  • for TL it shows the type of the processor for which the TL was chosen;
  • it clearly shows the IO method and file names (if used);
  • it supports multiple native languages in for problem title/statements;
  • It has an exact way to generate each of the generated tests;
  • solution tags (for example, a deliberately slow solution can be tagged as time-limit-exceeded);
  • precise paths to tests and other resources.

I don't know any other machine-readable descriptor formats in use that are so complete.

3. Polygon stores files for long-term and keeps them available

I can open the problems of the ACM-ICPC Saratov Subregional 2009 and edit a test. Everybody who has access to the problem can do the same. All the changes will be visible to all the coauthors, they will be notified via email and the automatic testing systems can get the changes when new problem package is built. I can run the solutions as I edit, all tests will be validated, all the solutions will be ran. But what happens if you don't use Polygon? For the time of contest developement a local version control system is used, it is usually shut down later and only the archive remains: we lose editing history, developing access, automated invocations and other things.

4. Polygon decreases the barrier to entry the problem preparation process

The Codeforces problem writers are the contest participants of different level of training, cultural and professional background, for many of them it's their first experience of preparing problems. They almost always easily understand what to do and how to do it, they can add problems. If you don't use Polygon, then the process is usually regulated by a system of unspoken rules (like, add suffix _slow, or _tl to the title of the slow solution), an unexperienced participant gets lost and cannot understand what to begin with and how to work. Besides, it usually requires some knowledge of basic principles of working with svn and command line and work differs for the Windows and Linux users.

5. Polygon helps you manage access

In Polygon you can give access to the problem to any registered user. If you work without Polygon, it is usually done by the version control system server administrator and you don't even have the list of your co-authors. You cannot manage access on your own, the access is usually managed at the contest level, not problem level.

6. Polygon has issue-tracking

When there is more than one developer working simultaneously, they absolutely need to be able to add and manage issues. Besides, issue-tracking is useful in individual work as well. It structures work, helps you not to lose track of the details. Whenever I've worked outside Polygon, the best task management I saw was a special file with a numbered list of tasks.

7. Polygon is easily integrated with online judges

Polygon offers machine-readable problem packages with prepared tests (for both Windows and Linux) or enables to generate them at package deploying. Polygon has a simple HTTP POST-based API to access data. While POST-queries are formed, you need to set the user's login and password parameters (and optionally, revision).

Say no to manually copying problems into the judging system, let the system upload the problem for you and deploy or update it.

8. Without Polygon the developer needs to have some special soft on his PC

For example, a developer with Windows may need bash to run doall.sh that generates all the tests. Or a Java programmer will have to install C++ to compile the checker. Use LaTeX to compile the statement. Polygon sets you free from all of that, lots of work is done on the side of the server.

9. Polygon is safer than most alternative ways of shared development

Polygon uses HTTPS, you can attach browser session to IP-address (it is optional, of course), session is attached to User-Agent, we use CSRF-tokens everywhere.

10. Polygon classifies and indexes problems

You will never get lost in problems. I have about 500 problems in Polygon made by me only, but due to tags, filters, search and sorting into contests I never get lost in them and can quickly find what I need.

The End

Those are only the first reasons that came to my mind at 2 AM. I am sure that we can come up with some more of them after some thorough thinking.

The conclusion is simple. Every time you make a problem not in Polygon, god kills a kitten.

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

| Write comment?
»
9 years ago, # |
  Vote: I like it +14 Vote: I do not like it

The best part of Polygon:

Easier platform -> More contest writers -> MORE CODEFORCES ROUNDS!

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

Hi, Mr.Mirzayanov, perhaps you could help us with a polygon issue. Recently, minimario and I have been trying to prepare problems on Polygon; however, it seems that input with space separated integers is not supported for standard checkers (and the checkers I made...). The checker crashes each time... Thanks in advance, trophies

PS: I post here, because, if any other people are facing the same problem, they can just look at this thread.

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

    It is completely supported. I think that you are doing somethig wrong. You can share a problem to any experienced writer and he could help you.

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

https://polygon.codeforces.com/c/contestid/english/statements.pdf Does this means if I write https://polygon.codeforces.com/c/482/english/statements.pdf i will be able to download the Round 275 Div1 problems as pdf?

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

    No, contestid stands for the internal Polygon id of a contest in the Polygon. Polygon doesn't know about Codeforces.

    This feature is useful to integrate some online judge with Polygon.

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

"I first publicly spoke about Polygon in a narrow circle of Russian teams' coaches on ACM-ICPC World Finals in 2009. I cannot say that everybody was enthusiastic about the innovation. Some people were openly skeptical about such system's viability and relevance."

Its nice to see when a new idea that is not well accepted at the beginning takes flight, and becomes something as useful as Polygon is now.

F*ck the skeptics, and keep up the good work!!

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

Are there any ways to make members in a group can view wrong testcase from Codeforces Mashup?

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

Polygon looks great! I started to develop a problem.

One question. What languages are supported for checkers, validators, generators, and sample solutions? Thanks.

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

    Thanks! Right now Polygon supports C++, Java, Python 2, Perl and Ruby. In nearest plans to support Python 3 and C++0x. The main reason why we do not support wide range of languages that a problem package should be easy to build. For example, as you know it not easy to install OCaml on Windows correctly. And it is not cool to require it to build a package.

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

Hi, Polygon looks like a great system! Thanks!

However, I couldn't figure out how to download all test data (input + output files).

I suppose this should be handled by Packages, but whenever I create a full package I get PackageException: Got exception while generating tests.

Please help!!

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

    Are you sure that complete invocation returns no error? I'll write you in usertalks the details.

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

    Your problem fails to be run on testset "tests". You have invalid test or something like it.

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

      Oh, Yes..!!

      I was only using the other testset, so didn't realize this. Thanks for the help. It's really an awesome tool.

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

11 — Polygon is awesome!

I've been the ACM Arab regional contest chief judge for three years, and Polygon saved a lot of time and effort while preparing the problems.

Thanks a lot MikeMirzayanov!

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

Is there a tutorial about the API?? I couldn't manage to find it.

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

    I tried to find it once again, but I couldn't. What parameters should I give to the link? And, are there more APIs that I can use?

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

Hi, I was wondering: is Polygon server sourcecode open? If not, why? I think that opensourcing it would be a huge boost to development.

»
8 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Not sure this is the best place to write this, but I couldn't find a bug/issue tracker for Polygon.

How can I include testcases in the problem statement that contain '#', i.e. a sharp? When trying to generate a PDF file, the LaTeX process throws an error. In the statement itself I can escape it writing '\#' (while still rendering fine in HTML), but not in the testcase data.

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

    you may want custom input/output for that

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

      I'm not sure I understand your suggestion. If you mean to add a testcase not generated by a script: I tried that, but generating the PDF still failed.

      I think this could be fixed by modifying the LaTeX templates: olymp.sty already provides a command \exmpfile instead of the \exmp used in the default problem.tex. That command uses a verbatim environment to include the testcase as file. However, I don't know what to replace ${test.input} with to reference the testcase file, instead of its contents.

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

        I mean you may go to setting of specific test, there will be an option to use custom input/output.

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

want another Christmas tree :3

»
5 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Polygon can be tricky at first glance but after some testing it is surprisingly simple and helpful. All I needed was just an afternoon and a cup of coffee to get a grasp on it.

I hope the platform gets more recognitions in the future.