MikeMirzayanov's blog

By MikeMirzayanov, 13 years ago, translation, In English

We've made it! Or in any case, we are at least very close to it.

On January 19, 2012 at 12:00 we open a sub-project called "Gym". In short, its goal is to enable the Codeforces coders not only to participate in competitions and discuss them, but also to train and coach easily.

In fact, despite the wide diversity of online judges in the world, a well thought-out training service system does not exist. So, the expectations from this system are:

  1. Collection of online contests, composed mainly of the past official contests.
  2. Opportunity to integrate the final standings of past contests in the online contests to be able to train "against" the official participants.
  3. Opportunity to participate in the training at any time whatsoever, without fear that something breaks down and the server will fall. In short, reliability.
  4. Opportunity to write virtual contests and to solve the problems in a practice mode.
  5. Opportunity to participate both individually and as part of a team.
  6. Opportunity to keep the team while changing the team members.
  7. Opportunity to view various statistics and participation history, the possibility to compile and publish reports on selected participants/contest.
  8. Opportunity for a coach to add an online contest by him/herself, if this contest still does not exist. The process should be simple, reliable and maximally automated. The opportunity to parse the final standings of the past contests. The opportunity to add the attempts of the official participants to an online contest.
  9. Opportunity to view tests or other players' solutions for those who have solved the problem.
  10. Opportunity to find the training to one's taste, i.e. selecting by parameters.

The Codeforces Project:: The training aims to meet all these requirements. Already, nearly everything of the above list is available and whatever is not, will be available.

Let's go! All images are clickable.

For the participants

Go to the "Gym" section and choose a contest to your taste. Pay attention to the stars, they show the complexity of the training session. Order a contest online (as can be done with the usual Codeforces rounds) and proceed to the solution! You will be confronted with other online participants as well as with ghost participants (those who took part in this contest one day and turned up in the Codeforces system due to the analysis of the final standings file of the past contest).

Please do not solve a training session if you do not intend to put your own real efforts into it or if you've already seen these problems. The only contest on which you can test the system is the "2010 Codeforces Beta Round #1 (the training)", but even there a coach will also be influenced by the inadequate participation.

As you participate in training, you guarantee that you solve problems without assistance and that you do not send other people's solutions. The coaches will have the authority to move your solution from the "online participation" type to the "solution modifications" type if they see that you have violated these simple rules. If we find that we have a large number of such inadequate people in our community, we will be forced to limit access to the "Training" section judging by the rating, the invitations or something else. I hope that this will not happen.

For coaches

We have singled out a special role of a coach. Any red participant can become a coach as long as s/he is willing to make an effort to maintain and fill the "Training" section. Be sure to read the rules and obligations. Do not become a coach if you do not agree to follow them. You can enable/disable the coaching mode at any time. We understand that the presence of red is very tough. However, we want to try out the system for this limit. The fact is that the system is still rather crude on the one hand. On the other hand, we really do not want to make a mess there. Let's try to live with this limit, and play by the situation. Several additional coach accounts will be given out by us individually. Now let's proceed to the sweetest course - creating training sessions on one's own. To organize a training session you need the archive of the past contest:

  • full tests (if generators are used, then the tests must be pre-generated), including files with answers for each test;
  • original solutions;
  • checkers;
  • a final standings file in the form of the traditional ACM-ICPC standings in HTML (a link will do, you can also use the .dat file from TestSys).

Original solutions are not mandatory, but highly desirable. Checkers are needed only if the answer is ambiguous. The checkers must be compatible with testlib in terms by command line arguments (checker-file input output answer) and return codes (OK - 0, WA - 1 and 2, FAIL - any other value). Final results are also not required, but they can improve the training greately. Yes, we have a super-intelligent parser that can turn almost any HTML ACM-ICPC monitor into the participation log.

The "New Training" form

So first, click the "Create a new training session." If the contest doesn't have a Russian or English name, then just don't enter it. The start time may be omitted, but if you enter it, you can make not an online participation training but a full contest (which will then be available online). Leave the access level as "private" until the contest is completely ready. After that, it can be published.

Here goes very important information. The rules for naming contests are as follows: First comes the year when the contest was officially held (or a season, which is even better). There should be no spaces on either side of the hyphen in the name. Then follows the name of the championship (if there is any), then a rather detailed contest name. It can end with brackets containing the abbreviation followed by two digits representing the year. You do not have to use words "Programming", "Informatics" in the name. For example:

  • 2008-2009 All-Russian National School Team Olympiad (VKOSHP 08)
  • 2001-2002 ACM-ICPC Northeastern European Regional Contest (NEERC 01)
  • 2008-2009 Winter Petrozavodsk Training Camp, Saratov SU Contest
  • 2010-2011 LKSH, the August camp, problems on DP

Be sure to fill in the fields "Season", "Contest Type," "Country", "Location". You are advised to specify the country or the location by the place of birth or the place where the first original contest was held. In the advanced settings fill in the description, it will be available for the participants to view prior to solving problems. There you can specify the problem sources, if the training session is compiled from problems from different sources.

Codeforces Contest Wizard

The "Contest" tab

So, you fill in the "new training" tab, you press the "Create" button and you find yourself in the contest interface. The next step is filling the contest with problems. You should also add the ghost members, and their attempts from the final standings of the past contest. Read the blue box to the right carefully and open the Codeforces Contest Wizard. The first time it will take its time to open, but much will go the cache.

Carefully read everything that is written on its first tab. There's little text, and it will be useful. Are you done reading? Then click "Next".

The "Contest" tab can be used to adjust the training session length and select a file with the final standings which will be processed by the system. Select either a file (the HTML-document or the TestSys record in the dat format) or a link to it, then click "Parse". If all goes well, the "Problems" and "Teams" boxes will be filled automatically. If this does not happen, that means that the format is not supported. In this case, please let us know and add the problems one by one using "Problems:Add". If the problem does not have an English or Russian name, then leave them blank.


Prior to processing the final standings file

After processing the final standings file

Then, click "Next", the application will add several tabs - one for each task.

The "Problems" tabs

At each of these tabs, make sure you've entered the real name of the problem in the Problem name. Leave the name empty if the problem has no name in this language. Then click the big button on the top that reads "Select problem files and analyze problem". In the dialog box, select all the files that are relevant to the problem: tests, checker, solutions. You can select a little bit too much, that's not a problem. Usually you can just select the entire directory with the problem (if it is in a separate directory.) Click OK.

Then the magic begins. Using the modified code from http://mirror.codeforces.com/blog/entry/1637, the application determines which files are tests, and which ones are solutions, it determines the checker. Then the first test, the solutions and the checker (if there is any) are sent for analysis to Codeforces. There the received data are checked.

  1. The compilers are sorted, taking the extension into consideration, the compiler is by the compiler for each source. Free Pascal is here more preferable over Delphi and GNU g++ is more preferable over the Microsoft Visual Studio C++. If you cannot compile the source, then the necessary resources are automatically determined for it. Besides, if it is necessary, the code will be modificated. For example, it is possible that the old solution in C++ cannot compile because of wrong includes, then the 'includes' will be added automatically.
  2. The magic continues. For each solution the input-output file is determined automatically. The system supports stdin/stdout, input.txt/output.txt, *.in/*.out, and their combinations. For all solutions input-output files' names must match.
  3. Next, each solution is tested on the first test. The return code 0 is expected from the checker. The comparison is performed by words, ignoring spaces or new lines if the checker is not specified.
  4. If all goes well, the checker runs on the test and on the response to the test regarding it as the solution output. Of course, an OK is expected (i.e., the return code 0).
  5. The final touch. We have to verify that the checker actually can print something besides OK. It runs on the first test and on a random string as the output solution. In this case, the expected verdict is WA (i.e., the return code 1 or 2).
  6. Thus, all the points are completed. You can believe that the specified files are really similar to the solutions. They correspond to the tests. The checker looks like the checker. The processed data (possibly modified source texts + resources such as testlib.h) go back into Codeforces Contest Wizard.

The process of content analysis of the problem either ends with an error, then you need to correct something and click "Reanalyze problem", or you can move on. In the process of correction you can edit the results of auto-detecting file types, you can add or delete files and do other things. Sometimes the archive contains the deliberately wrong decisions attached. They do not pass even the first test: the easiest fix is simply excluding such decisions manually.

The "Attachments" tab

Everything is easier here. You should add statement files and additional materials. It is recommended to add the statements as a single file containing the texts of all problems (e.g., PDF or DOC). If the statements are sorted into several files, I usually compile a new DOC file with a full problem set. Always try to number the pages in the statements, add a header with the contest name.

You can select one or more files as statements. In the first case it will simply be added as it is and in the second case the files will be automatically packed in a ZIP-archive. The language must be indicated.

In the "Resources" section add various files that are related to the contest and that may be useful. For example, it may be the tutorials, some slides, test visualizers, statement sources and so on.

Finally, the "Package" tab

We are almost finishing, let's click the "Package" button. The system automatically validates all problems (see "Problems' tabs") and, if everything goes well, the system suggests to save the contest package. The most convenient way is to add it automatically directly to Codeforces. In this case, the system will open the FTP-connection and copy the contest.zip file to the folder contest root. There this file will be automatically (yes, sheer magic again) unzipped.

You can save the file locally if you want and check everything out: indicate the name with the .zip extension. Later this file called contest.zip can be added to Codeforces via FTP, but manually.

Of course, it's easier to a file to Codeforces automatically and enjoy this nice text.

Let's go back to Codeforces

The contest interface has an important link "Refresh contest". The thing is, all the changes that you can make and where the Codeforces Contest Wizard adds the data is a sandbox. To refresh the contest state by the current state of the sandbox, just click "Refresh Contest". It's not a big deal for large contests as Codeforces yet again validates everything it can get its hand on, to minimize the possibility of error. In addition, the contest adds ghost teams: After a few dozens of seconds of waiting you will be informed that the competition has been updated. You may see an error message - read it carefully and try to understand what the problem is. Probably something is wrong with the contest files.

At any time you log in go via FTP (using the Codeforces handle and password) and update some files manually. Note that for all descriptors the UTF-8 encoding is used, so save the data only in it. If you edit something manually, be highly careful and cautious. Having refreshed the contest state you will see that the problem list has been updated and the results are now supplemented by such merry ghosts.

We are a minute away from the end of the training. All that's left is sending all original solutions to the system and set time and memory limits. Do you think it's terribly boring to send original solutions? If the contest has 10 problems, and 3-6 original solutions per problem, that makes 30-60 files to send. No! It's absolutely easy! Go to the "Administration" section, click "Send all original solutions" and enjoy the result in "My submissions".

The last detail is setting limits. Either use the problem editing form or set time limits directly from the "My attempts" page using the time that some original solutions needs. In this case, the time limit is calculated by the formula RoundUp(3*T), where T is the solution time, and RoundUp is the function of rounding up to an integer number of seconds. We believe that this is a good heuristic to set the time limit. It is often even better to set a larger value, but it is highly not recommended to set a smaller one. Thus, preparing a contest is over. You can switch its access level to "protected" and show it to other coaches. If everything is well, you can open it and make it public. To inform the public about the new training session, you can write a post entitled the same as the prepared contest.

Conclusion

In conclusion I want to add that this is not even a beta yet, but we will do our best to quickly make the system really convenient and useful. We have done much to bring magic to Codeforces, to make the process of preparing a training session simple and reliable. I hope you will appreciate it. Please do not post specific bugs or feature requests here in comments. We will soon have a special post to report bugs and feature requests, please leave your comments there. Here is the place to arrange a general discussion of the system.

P.S. A little later I will add some screenshots to the text; it will be fun.

Wish you successful training,
MikeMirzayanov

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

»
13 years ago, # |
  Vote: I like it +30 Vote: I do not like it
This is a revolution, very exciting one. Thank you, Mike and the Codeforces team.
»
13 years ago, # |
  Vote: I like it +21 Vote: I do not like it
I saw a glimpse of the gym two nights ago but was disapointed in the morning when it had disappeared.The interface of the GYM is just amazing.You can select the level of the toughness of the problems and then work them out.thanks to Mike Mirzayanov and the whole codeforces team for such a wonderful platform they have given us.I am sure that if codeforces continues to inovate and develop it has been doing since its birth ,one day it will rule the world in terms of coding platforms. And that day is not far :)
»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Sounds good! Looking forward to it!
»
13 years ago, # |
  Vote: I like it +12 Vote: I do not like it
Such a great news and feature! Looking for more of it :-)
»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Now I have read all of the passage, it's really a powerful system for training, thank all of you!
»
13 years ago, # |
  Vote: I like it +6 Vote: I do not like it
Coders could add regional ACM ICPC contests from their respective regions. This would be extremely helpful for team training as you would know how you compare to the best teams from your region. 
»
13 years ago, # |
  Vote: I like it +11 Vote: I do not like it
May be its better to download *.pdf, but not *.doc ?
»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Somebody please help me.May be I am not getting what I am expecting or I have misread something.
I am finding The gym is just like the other "virtual contest".Its just seeing the problems and answering them.How can I know the solution of a particular problem and when does the coach come to help me??
  • »
    »
    13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Select the gym, click "Enter". In the right section click "Register for practice". Now click on the airplane near the problem name - that is how you can send you code for checking. And it is not virtual contest.

    There is not any coach. You can ask you question in the blog or send a private message to author of contest.
    • »
      »
      »
      13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      So how is it different from a virtual contest apart from the thing that we can filter the contest we are participating ??I mean how is it going to help me "differntly"??
      • »
        »
        »
        »
        13 years ago, # ^ |
          Vote: I like it +8 Vote: I do not like it
        Red coders may post contests there without any contacts with admins.
»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I downloaded the "wizard.jnlp", but could not run it. It says, "Fatal: Read Error: Could not read or parse the JNLP file". Detail: net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file. at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:491) at net.sourceforge.jnlp.Launcher.launch(Launcher.java:283) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:202) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) Caused by: net.sourceforge.jnlp.ParseException: Invalid XML document syntax. at net.sourceforge.jnlp.Parser.getRootNode(Parser.java:1274) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:204) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:188) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:173) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:159) at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:482) ... 5 more Caused by: net.sourceforge.nanoxml.XMLParseException: XML Parse Exception during parsing of the XML definition at line 1: Unexpected end of data reached at net.sourceforge.nanoxml.XMLElement.unexpectedEndOfData(XMLElement.java:1094) at net.sourceforge.nanoxml.XMLElement.readChar(XMLElement.java:877) at net.sourceforge.nanoxml.XMLElement.scanWhitespace(XMLElement.java:596) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:500) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:464) at net.sourceforge.jnlp.Parser.getRootNode(Parser.java:1270) ... 10 more Caused by: net.sourceforge.jnlp.ParseException: Invalid XML document syntax. at net.sourceforge.jnlp.Parser.getRootNode(Parser.java:1274) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:204) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:188) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:173) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:159) at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:482) at net.sourceforge.jnlp.Launcher.launch(Launcher.java:283) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:202) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) Caused by: net.sourceforge.nanoxml.XMLParseException: XML Parse Exception during parsing of the XML definition at line 1: Unexpected end of data reached at net.sourceforge.nanoxml.XMLElement.unexpectedEndOfData(XMLElement.java:1094) at net.sourceforge.nanoxml.XMLElement.readChar(XMLElement.java:877) at net.sourceforge.nanoxml.XMLElement.scanWhitespace(XMLElement.java:596) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:500) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:464) at net.sourceforge.jnlp.Parser.getRootNode(Parser.java:1270) ... 10 more Caused by: net.sourceforge.nanoxml.XMLParseException: XML Parse Exception during parsing of the XML definition at line 1: Unexpected end of data reached at net.sourceforge.nanoxml.XMLElement.unexpectedEndOfData(XMLElement.java:1094) at net.sourceforge.nanoxml.XMLElement.readChar(XMLElement.java:877) at net.sourceforge.nanoxml.XMLElement.scanWhitespace(XMLElement.java:596) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:500) at net.sourceforge.nanoxml.XMLElement.parseFromReader(XMLElement.java:464) at net.sourceforge.jnlp.Parser.getRootNode(Parser.java:1270) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:204) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:188) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:173) at net.sourceforge.jnlp.JNLPFile.(JNLPFile.java:159) at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:482) at net.sourceforge.jnlp.Launcher.launch(Launcher.java:283) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:202) at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) at java.security.AccessController.doPrivileged(Native Method) at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168)

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

    Please, write me in talks.

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

    I don't know whether you're using OpenJDK, but this is pretty much what happens there. You should use Sun's Java implementation under Linuxes and such.

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

      I tried to use Sun Java 6 Web Start to open it, but I failed as well.

      Previously, I used IcedTea Java Web Start to open it.

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

I don't know, may be it is not appropriate to write here. Today i tried to virtually participate in 2011-2012 Wrocław Short Training Contest (contest 7) ,but i couldn't download the problem statement. Each time it says can't send statement. What is the problem?

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

How to add attachments to GYM contests?

I don't mean statements attachments. I mean additional files which are related to the contest but are not problem statements.

In Codeforces Contest Wizard, there is an option to add "Resources: tutorials, slides, etc." under the Attachments tab. I have done this and have uploaded the package to Codeforces Taskbook automatically. I check via FTP that the files are indeed inside the sandbox/files folder. However, unlike problem statement attachments, if I update the contest in GYM, these other attachments don't show up. I can't manually add them either because I don't know the URLs of these files.

I also know that it's possible to add attachments linking to external services like Google Drive, but since my attachments are already living in Codeforces servers somewhere (using Taskbook), I'm thinking there has to be a way to access and link them from a GYM contest. On reading the section about attachments in this blog, it seems it must be possible, but I'm not sure.

I can't find this information anywhere and already wasted some time tinkering. Has anyone tried this before? Can anyone help?