Try   HackMD

Universal Cup / CF Gym に移植する方法

Polygon に移植

Polygon とは、Codeforces の問題作成プラットフォーム
サーバー側で実行をすべてやってもらえて、結果だけ返ってくる

https://polygon.codeforces.com/

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

これで始まる問題文は主に Polygon で作られる

コンテストを作成

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

これは後で変更できる

コンテストページ

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

問題枠を作成

コンテストページの New Problem から問題枠を作成

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

TL・ML の設定 (General Info)

デフォルト 1 s / 256 MB なので 2 s / 1 GB に上げる (1 GB より大きい ML を設定できない!)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

output_checker の設定 (Checker)

testlib/checkers がテンプレートとして用意されている。
wcmp がいつもの (whitespace を無視した完全一致)
特殊なジャッジをする場合は、testlib を使った checker をアップロードする。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

入力をアップロード (Tests)

generator を置くのは面倒なので、直接入力をアップロードしてしまうのが良い。入出力が巨大な場合は testlib を使った generator を置くことを検討しても良い (したことなし)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Add Test → from the files でアップロード

Example を指定し、一番上に持ってくる

想定解をアップロード (Solution Files)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

アップロードするとコンパイルされて言語が自動的に入る 謎に CTLE することがある 実行が遅い!
(Python ファイルはデフォルトで CPython になるので、PyPy に変更する。)
UCup で適切な TL だと Python の実行は普通 TLE するので、Type を Correct or TLE に変更する。

出力を生成

Tests → Preview Tests で生成された出力を確認できる
Invocations で AC かどうかは確認できるので、慣れたら見なくて良い

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

解答をジャッジする (Invocations)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

CPU が古いので割り算が顕著に遅い (3 倍くらい)
一方 UCup の CPU は AtCoder と同じ性能

問題文・解説 (Statement)

LaTeX で問題文を作ることになる
使える LaTeX のパッケージは少ないなので注意:

\usepackage {amsmath}
\usepackage {amssymb}
\usepackage {comment}
\usepackage {epigraph}
\usepackage {expdlist}
\usepackage {graphicx}
\usepackage {multirow}
\usepackage {siunitx}
\usepackage {ulem}
\usepackage {import}

罠 : \lt, \gt は存在しない

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

AtCoder の入力フォーマットを再現するために作った枠

\newcommand{\formatbox}[1]{
\framebox[\textwidth][l]{\begin{tabular}{l}
#1
\end{tabular}}
}

お願い ChatGPT

  • 英語に翻訳と LaTeX に翻訳の 2 段階に分ける
  • 問題文が非常に長い場合は精度が落ちるので、2 ~ 3 分割する
  • 翻訳が微妙なときは…
    1. 日本語が分かりにくくなっているので修正する
    2. 自分の英語力が足りていないので調べる
    3. 何回か生成し直す

プロンプト

以下の競技プログラミングの問題を自然な英語に翻訳してください。出力はコードブロックに入れてください。数式は $ で囲んだままにしてください。プレースホルダはそのまま残してください。

```
<問題文>
```
```
<問題文>
```

上の Markdown で書かれた問題文を LaTeX に翻訳してください。
出力はコードブロックに入れ、以下の形式で出力してください。
数式は $ で囲んだままにしてください。

```
\section*{Legend}

% 問題文をここに書く

\section*{Input format}

\newcommand{\formatbox}[1]{
\framebox[\textwidth][l]{\begin{tabular}{l}
#1
\end{tabular}}
}

The input is given in the following format:

% 入力形式をここに書く
% ~~~ で囲まれた入出力を表す部分は、代わりに \formatbox{} で囲む

\begin{itemize}
% 制約をここに書く
\end{itemize}

\section*{Output format}

% 出力形式をここに書く

\section*{Note}

% サンプルは取り除き, サンプルの説明をまとめてここに書く
% 何番目の入力例を説明しているか分からなくなるので、`In the first example,` のような文章を追加する
```

画像を追加する

Statement の一番下に Statement Resource Files がある

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

\begin{center}
\includegraphics[width=0.6\textwidth]{fig1-YBEIlM.png}
\end{center}

Example の幅を変える

結局 LaTeX がコンパイルされているだけなので、ソース を見ればいろいろいじれる

\addtolength{\exmpwidinf}{6.1cm}
\addtolength{\exmpwidouf}{-5cm}

変更を commit する

問題は git 管理されていて、変更を commit しないと他の人から見ることができない。

未 commit の変更があると赤くなるので注意!

成果物のダウンロード (Packages)

UCup 運営に渡す前に、全問題の Verify 付き Package を作っておく。
Verify のために自動的に Invocation が走る。

Gym に入れる

https://codeforces.com/blog/entry/10077

Polygon でユーザ codeforces に権限を与え、Package を生成すれば Gym から問題が import 可能になる

UCup に入れる

Qingyu さんに連絡して Qingyu さんに権限を与える

Ghost を作る

https://github.com/verngutz/CFgym-ghost-file-generator/blob/master/DOMjudge-to-CFgym.py を参考に手動で CF Gym 形式のファイルを作りました… (部分点があると全員移すのはきびしい)
あとは Qingyu さんにおまかせ (どういうフォーマットが良いのかは聞いていません)