ATSTNG's blog

By ATSTNG, history, 4 months ago, In English

I would like to ask about certain features in problemsetting with CF and Polygon that I was not able to figure out how to use (or not even sure if they are supported at all). Probably some of them deserve feature requests.

SVG images in problem statements

Scalable Vector Graphics is a nice format to draw simple images and schemes that can be very lightweight and can be intergated directly into HTML page.

Now if you include SVG image with

\includegraphics[scale=1]{a.svg}

it will be substituted with PNG version of the image in HTML and will fail to build PDF with

LaTeX Error: Cannot determine size of graphic in a.svg (no BoundingBox).

What am I doing wrong?

Animated GIFs in problem statements

Providing animated example is a great way to explain processes that are described in the problem. Providing an external link to GIF feels somewhat inconvenient.

Now if you include animated GIF with

\includegraphics[scale=1]{s.gif}

it tries to substitute it with PNG image, but the link is broken and it renders missing image in HTML.

Is it possible to make it work?

Custom HTML / JS in problem statements

If problems statement is just an HTML page it can be cool to enhance it with static frontend JS-based application that can play animations or provide interactive examples for participants. Especially for education purposes.

Yes, an ability to include user-written JS script can be a serious security issue, but in some way you have trust the contest author anyway.

Ghosts in gym standings

Ghost participants of past competititon is a really cool feature. I'm planning to add some contests from different platform to the CF gym, and I would also like to export ghosts data for them. But how to configure ghosts for a mashup? What format does it use?

I've only found Export the judgment log to DAT-file section with Ghosts checkbox, but this is not the way to include it.

Different LaTeX or different examples for HTML and for PDF outputs

When problem statement is going to be used in both ways in HTML and in PDF, it is very annoying when you would like to make them a little different in layout. For example long lines in input/output examples are perfectly fine in HTML version, but will not fit into default PDF layout and it is good to provide custom input/output data for it, but only in PDF.

Also PDF and HTML statements are rendered differently and some LaTeX can work in one of them, but break the other one.

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

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

SVG images in problem statements

There is probably no way, unfortunately, at least one that doesn't rely on some dreadful hack. LaTeX doesn't really support SVG natively. There are packages to help you here (you can include packages by editing the olymp.sty file) but the main one, svg, requires that you use --shell-escape when compiling. In any case, if you use exotic commands, then HTML doesn't work anyway.

Animated GIFs in problem statements

This you can do. Change the file extension to .png on your computer before uploading. Don't actually convert the image to a PNG, just change the filename. Codeforces does something weird when preprocessing GIFs. But if you upload a GIF that pretends to be a PNG, it works fine. You can't use the scale parameter here, even with value 1, because the backend can't scale the image with an incorrect extension. This also doesn't work on PDFs, but I assume you don't want to display an animated GIF in one anyway.

Ghosts in gym standings

Go to your mashup, then ADM -> Ghosts. It supports multiple formats, but the "easiest" one (in the sense that it is easy to convert anything to it) is the DAT-file. Here is a pastebin of the DAT file for this contest (blue-background participants only, also I had to blank out Jiahe Wang's last name because pastebin thinks it is "potentially offensive or questionable content"). The first five lines should be obvious. After that:

  • @p lines denote problems: @p [problem id],[problem name],[penalty time],[don't know]
  • @t lines denote teams: @t [team id],[don't know],[don't know],[team name]
  • @s lines denote submission: @s [team id],[problem id],[attempt count],[time in seconds],[verdict]. Verdict is one of OK, TL, ML, RT (runtime error), CE, TL, WA. Also I think RJ also exists for a "generic" Rejected verdict.

Different LaTeX or different examples for HTML and for PDF outputs

What I've done sometimes is to prepare the contest for HTML in Polygon, then download the contest package, extract it and make the changes manually on my own computer. It kind of breaks the already limited version control though.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For the animated image, there is APNG extension, which is PNG but animated. Weirdly APNG files can also end with .PNG. So I prefer convert my GIF into APNG instead of just renaming.

    I think Polygon does not change the image, but maybe the browser handle the image file automatically. This is more likely because image file format normally starts with their extension, so browser can just base of that.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you for very detailed answer.

    My issue with ghosts was that ADM. > Ghosts just will not appear for mashups with Contest format: IOI. It works well in ICPC mode and it is possible to configure ghosts in ICPC mode and switch to IOI mode, but it will only show accepted problems with green 0 points even for problems that have points set up properly. I've tried to google up a proper DAT-file format for it or to bruteforce it up, but every time Codeforces changed [penalty time] and [don't know] params back to default. I guess IOI ghosts are not supported.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    We have a tool in icpc-live, which can convert any format we are able to parse to some standard formats. I think codeforces should support pcms XML, but I can support dat files, they are easy.

    Unfortunately, we need full API access, not only scoreboard, which can limit usages a lot. But for domjudge for example it should work even with public API, if its set up.

    Would it be useful to make it something usebale not only by me and Lidia?

    (btw, here is parser of dat file format for icpc live, maybe it contains some more insides on what is possible).