Polygon

This page briefly introduces the collaborative problem-setting platform Polygon.

Introduction

What Is Polygon

Website: Index Page - Polygon

Polygon is a problem-setting platform that supports collaboration among multiple people and has very comprehensive features. Its official website describes it as "a platform for creating programming contest problems."

Polygon must be used to set problems on Codeforces (CF). For setting problems elsewhere, especially collaboratively, Polygon is also a good choice.

Advantages

  • It has a version-control system, so collaborative work does not become chaotic and files do not need to be passed between people.

  • It has a complete problem-setting system: validators, generators, checkers, and solutions are closely connected, and outputs are generated automatically.

  • You can set tags for solutions. It warns when a wrong solution is AC or the correct solution is not AC, making it convenient to eliminate wrong solutions one by one.

  • Differential testing is convenient, and data found by differential testing can be directly added to the problem data.

  • Issues can be raised when problems are found, rather than having messages get buried while the problem remains unfixed.

  • It prepares you for setting problems on Codeforces in the future.

  • ……

Problem List

The problem list displays basic information about a problem, such as the status of the statement and tutorial, the status of data generation, and the settings of the standard solution, validator, and checker.

You can double-click the "Name" column in the problem list to write a note, such as something you need to remind yourself to do (need to add more tests/need to write tutorial), or the score distribution planned for the problem. You can fill it in as you like, or leave it blank.

In "Rev.", the "x/y" means that x is the version of the current problem and y is the version of the package. If the two are different, y is displayed in red.

In "Edit session", "Start" means that your account has not viewed this problem, while "Continue (x) Discard" means that your account is on version x of this problem. Clicking "Start" or "Continue (x)" enters the problem-management interface. Clicking "Discard" irreversibly cancels all your changes and returns to the state in which you have not viewed this problem.

If your account has unsubmitted changes to a problem, the entire row in the problem list turns red.

Problem Management

Most Polygon features do not need to be learned; if you can understand English, you can basically use it.

Warning

Statements cannot use Markdown; they can only use TeX.

  • Invocation is used to test solutions.

  • Stress is used for differential testing.

  • Data is generated by generators in Tests, and generators are uploaded in Files.

General Info

On this page, you can set the problem's time limit, memory limit, problem type, tags, and contest.

At the bottom of the page, "statement sketch" and "tutorial sketch" can be used to edit drafts of the statement and tutorial. Note that these two items will not appear in the official statement or tutorial.

Statement

This page is used to write the statement and tutorial. You can also use the "Review" button to view the statement, validator, and checker, generally for review.

Both statements and tutorials must use TeX syntax, not Markdown. For example, use \textbf{text} instead of **text**. However, Polygon actually supports only a very small subset of TeX; you can find the details by trying it yourself.

You can view the rendered statement through the "In HTML" link at the top, and view the rendered tutorial through "Tutorial in HTML".

If you need to add an image to the statement, first upload it under "Statement Resource Files", then add \includegraphics{filename.png} to the statement.

Files

"Source Files" stores code other than solutions, such as validators, checkers, and generators. If the problem is an IO-style interactive problem, it also stores the interactor.

If this code needs to include other files, such as Tree-Generator, put them in "Resource Files".

For grader-style interactive problems, see the official tutorial.

Checker

testlib.h provides some built-in checkers, with brief descriptions in the selection box. You can also select one and click "View source" to view its source code.

If you need to write a checker yourself, see the checker tutorial.

The "Checker tests" below allow you to add several outputs and their expected judging results through "Add test", and then click "Run tests" to test whether the checker returns the judging results correctly.

Interactor

Only needed for IO-style interactive problems; see the interactor tutorial.

Validator

A validator is used to check whether data is valid. For writing one, see the validator tutorial.

The "Validator tests" below are similar to "Checker tests": input and the expected validity must be provided to test the validator.

Tests

This page is used to manage data.

On Polygon, the recommended approach is to use a small number of generators with command-line arguments to generate data, rather than writing many generators or modifying a generator each time a data set is generated. Moreover, only the input needs to be generated; the output is generated automatically.

"Testset" is a test set. If you are setting problems for Codeforces, you need to manually add a Testset called "pretests", and "pretests" must be a subset of "tests".

"Add Test" manually adds a data set, generally for manually entered samples or small data. Although data can be uploaded through files, this is not recommended; data should either be entered manually or generated by a generator under certain parameters.

If "Use in statements" is checked, this data set becomes a sample and is automatically added to the statement. If the statement needs to display input and output that are not the sample (generally for interactive problems), click "If you want to specify custom content of input or output data for statements click here" and enter the input and output you want to display in the statement.

The bottom of the Tests page is used to enter scripts for generating data, such as generator-name [params] > test-index. You can use generator-name [params] > $ to avoid manually specifying test-point numbers.

You can refer to the tutorial provided by Polygon to use Freemarker to generate scripts in batches.

"Preview Tests" previews the generated data.

Stresses

This page is used for differential testing.

Click "Add Stress" to add a differential test. "Script pattern" is a script for generating data, in which notation such as "[10..100]" can be used to randomly select a value in a range.

Then run the differential test. If an error is found, "Crashed" is displayed, and the data can be added to Tests with one click.

Solution Files

This page is used to store code that solves the problem, which may be either the intended solution or a wrong solution. Uploading wrong solutions makes it convenient to eliminate them and can also remind you to eliminate them.

Invocations

This page is used to run solutions.

Select the code and test points to run them, and then click an item in the list ("View") to see detailed information.

The judging status "FL" means that judging failed. Usually, the data did not pass validation, or the validator/checker/interactor or something similar received an RE. "RJ" has two possible meanings: one is that "FL" occurred, and the other is that this code did not pass its first test point.

If the running time is between half and twice the time limit, it is marked in yellow.

If some variable in the data has not reached its minimum or maximum value, a reminder is shown at the bottom.

Issues

The place to raise issues.

Packages

A package contains all information about a problem. When setting a problem for Codeforces, it is the basis for Codeforces judging (for example, if a problem needs to be fixed during a contest, updating the package is what affects Codeforces); at other times, it can be used for export.

"Verify" tests that all solutions have labels consistent with their results (AC, WA, TLE), that the checker passes checker tests, and that the validator passes validator tests.

Manage Access

Manage permissions for the problem.

The first section displays basic information. If something does not meet the requirements (for example, Tests does not contain pretests or there are duplicate test points), it is displayed in yellow; hovering the mouse over it shows the specific information.

"View changes" lets you view the modification history. Note that "switch" cannot be used to revert to a particular version; it can only be used to make conflict-free changes based on a version, which is meaningless in practice, so switch is effectively read-only.

"Update Working Copy" obtains updates from others.

"Commit Changes" submits your updates.

When committing, any non-conforming or warning items are listed.

Contest Management

If you want to set a contest, you can create one through "New Contest", which makes problem management more convenient.

"Add problems?" in the upper-right corner of the problem list on the contest-management page adds an existing problem to the contest.

"New problem" in the sidebar creates a new problem and adds it to the contest.

"Manage problem access" above shows the permissions for each problem, while "Manage developers list" below manages the people who have permission for this contest. Creating a problem through "New problem" and adding a new developer automatically adds the corresponding permissions, but problems added through "Add problems?" do not grant permissions to existing developers.

The sidebar can also preview all statements, all tutorials, and all validators and checkers; download the package for the entire contest; and renumber the problems.

Conflict Resolution

When Polygon is used collaboratively to set problems, a conflict (Conflicted) occurs if the version of the problem currently being modified differs from the remote version and the modified files cannot be merged automatically when obtaining the latest version from the remote or submitting updates.

After a conflict occurs, Polygon provides a "Resolve conflicts" option for the conflicted problem. Users can resolve conflicts in the conflicting files there.

This content comes from OI Wiki: Polygon. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.