Codeforces and Polygon may be unavailable between Aug. 17, 19:00 (UTC) to Aug. 17, 22:00 (UTC) due to planned power outages.

Statements TeX manual

This is a brief manual for formatting statements of your problems.

If you are planning to write statements only to show them in PDF format, you can use all available commands which are supported by LaTeX. However, if you are planning to show statements in HTML, you need to know that there is a limited set of TeX commands which are supported by our systems. All supported commands when rendering to HTML are provided below:

       ' '   << >>    ''   ~---   "---   \bf   \textbf   \it   \textit   \t   \tt   \texttt   \emph   \underline   \sout   \textsc   \tiny   \scriptsize   \small   \normalsize   \large   \Large   \LARGE   \huge   \Huge   \begin{itemize}   \begin{enumerate}   \begin{lstlisting}   \begin{center}   \begin{tabular}   \hline   \cline   \multicolumn   \multirow   \url   \href   \includegraphics   \def \htmlPixelsInCm   \epigraph 

When MathJax is used for rendering formulas (which is true for all problems created after 1 Jun 2021), the commands used in inline mode are not restricted by our systems. It means you can use any mathematical symbol supported by modern LaTeX.

Formulas using MathJax:

 These are inline formulas: $x$, $a_i^2 + b_i^2 \le a_{i+1}^2$. Afterwards... These are inline formulas: $x$, $a_i^2 + b_i^2 \le a_{i+1}^2$. Afterwards... These are centered formulas: $$x,$$ $$a_i^2 + b_i^2 \le a_{i+1}^2.$$ Afterwards... These are centered formulas: $$x,$$ $$a_i^2 + b_i^2 \le a_{i+1}^2.$$ Afterwards... Some complex formula: $$P(|S - E[S]| \ge t) \le 2 \exp \left( -\frac{2 t^2 n^2}{\sum_{i = 1}^n (b_i - a_i)^2} \right).$$ Some complex formula: $$P(|S - E[S]| \ge t) \le 2 \exp \left( -\frac{2 t^2 n^2}{\sum_{i = 1}^n (b_i - a_i)^2} \right).$$

If you want to start new paragraph, insert newline not once but twice:

 First paragraph. Still first paragraph. First paragraph. Still first paragraph. First paragraph. Second paragraph. First paragraph. Second paragraph.

Text style commands:

 \bf{This text is bold.} or \textbf{This text is bold.} This text is bold. \it{This text is italic.} or \textit{This text is italic.} This text is italic. \t{This text is monospaced.} or \tt{This text is monospaced.} or \texttt{This text is monospaced.} This text is monospaced. \emph{This text is underlined.} or \underline{This text is underlined.} This text is underlined. \sout{This text is struck out.} This text is struck out. \textsc{This text is capitalized.} This text is capitalized.

Text size commands:

 \tiny{This text is 70\% of normal size.} This text is 70% of normal size. \scriptsize{This text is 75\% of normal size.} This text is 75% of normal size. \small{This text is 85\% of normal size.} This text is 85% of normal size. \normalsize{This text is 100\% of normal size.} or just This text is 100\% of normal size. This text is 100% of normal size. \large{This text is 115\% of normal size.} This text is 115% of normal size. \Large{This text is 130\% of normal size.} This text is 130% of normal size. \LARGE{This text is 145\% of normal size.} This text is 145% of normal size. \huge{This text is 175\% of normal size.} This text is 175% of normal size. \Huge{This text is 200\% of normal size.} This text is 200% of normal size.

List commands:

 This is the unordered list: \begin{itemize} \item This is the first item; \item This is the second item. \end{itemize} This is the unordered list: This is the first item; This is the second item. This is the ordered list: \begin{enumerate} \item This is the first item; \item This is the second item. \end{enumerate} This is the ordered list: This is the first item; This is the second item.

Source code inserting commands:

 Some C++ source code (auto-detecting and highlighting): \begin{lstlisting} #include int main() { int a, b; std::cin >> a >> b; std::cout << a + b << std::endl; } \end{lstlisting}  Some C++ source code (auto-detecting and highlighting): #include int main() { int a, b; std::cin >> a >> b; std::cout << a + b << std::endl; }
 Link to website: \url{https://codeforces.com/}. Link to website: https://codeforces.com/. Link to website with caption: \href{https://codeforces.com/}{Codeforces}. Link to website with caption: Codeforces.

If you want to center content, use the following command:

 \begin{center} This content is centered. $abacaba$ \end{center} This content is centered. $abacaba$

If you want to insert some images in your statement, first you need to upload your image via Statement Resource Files section at the bottom of Statements page. When you successfully uploaded your image, you can use them in statements. Let's assume the image named 'polygon-logo.png' is already uploaded:

 Unscaled image: \includegraphics{polygon-logo.png} Unscaled image: It is strongly recommended to center and caption your images. If you plan to use 'width' property of \includegraphics, the actual width will be calculated as product of width in cm and value of constant \htmlPixelsInCm (which by default is 37.8). Command \def can be used only for defining \htmlPixelsInCm yet.

 \begin{center} \includegraphics{polygon-logo.png} \\ \small{Centered unscaled image.} \end{center} Centered unscaled image. \begin{center} \includegraphics[scale=1.5]{polygon-logo.png} \\ \small{Centered scaled image.} \end{center} Centered scaled image. \begin{center} \def \htmlPixelsInCm {45} % pixels in 1 centimeter in HTML mode \includegraphics[width=4cm]{polygon-logo.png} \\ \small{Centered image with width specified (180px).} \end{center} Centered image with width specified (180px).

If you want to insert tables in you statements, you can use syntax from TeX including specification of text alignment for each column and borders:

Simple table without borders:
\begin{tabular}{ll}
First & Second \\
Third & Fourth
\end{tabular}
Simple table without borders:
 First Second Third Fourth
More complex table with borders:
\begin{tabular}{|l|c|r|} \hline
Left aligned column & Centered column & Right aligned column \\ \hline
Text & Text & Text \\ \hline
\end{tabular}
More complex table with borders:
 Left aligned column Centered column Right aligned column Text Text Text
Scoring table example:
\begin{center}
\begin{tabular}{ | c | c | c | c | } \hline
\bf{Group} &
\bf{Points} &
\bf{Req. groups} \\ \hline
$1$ & $b = a + 1$ & $30$ & --- \\ \hline
$2$ & $n \le 1\,000$ & $10$ & examples \\ \hline
$3$ & $n \le 10^7$ & $20$ & $2$ \\ \hline
$4$ & --- & $40$ & $1$, $3$ \\ \hline
\end{tabular}
\end{center}
Scoring table example:
 Group Add. constraints Points Req. groups $1$ $b = a + 1$ $30$ — $2$ $n \le 1\,000$ $10$ examples $3$ $n \le 10^7$ $20$ $2$ $4$ — $40$ $1$, $3$
\begin{center}
\begin{tabular}{cc}
\includegraphics{polygon-logo.png} &
\includegraphics{polygon-logo.png}
\end{tabular}
\small{Images side by side example.}
\end{center}  Images side by side example.

If you need to create more complex tables, you can use the following commands:

Advanced scoring table example (colspan and rowspan):
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2}{*}{\bf{Group}} &
\multirow{2}{*}{\bf{Points}} &
\multirow{2}{*}{\bf{Req. groups}} \\ \cline{2-3}
& $n$ & $a_i$ & & \\ \hline
$1$ & $n \le 10$ & --- & $12$ & --- \\ \hline
$2$ & $n \le 500$ & $a_i \le 100$ & $19$ & --- \\ \hline
$3$ & --- & $\sum a_i \le 10^9$ & $41$ & --- \\ \hline
$4$ & --- & --- & $28$ & $1$, $2$, $3$ \\ \hline
\end{tabular}
\end{center}
Advanced scoring table example (colspan and rowspan):
 Group Add. constraints Points Req. groups $n$ $a_i$ $1$ $n \le 10$ — $12$ — $2$ $n \le 500$ $a_i \le 100$ $19$ — $3$ — $\sum a_i \le 10^9$ $41$ — $4$ — — $28$ $1$, $2$, $3$
Simultaneous colspan and rowspan:
\begin{center}
\begin{tabular}{|c|c|c|} \hline
\multicolumn{2}{|c|}{\multirow{2}{*}{Cell}} & Cell \\ \cline{3-3}
\multicolumn{2}{|c|}{} & Cell \\ \hline
Cell & Cell & Cell \\ \hline
\end{tabular}
\end{center}
Simultaneous colspan and rowspan:
 Cell Cell Cell Cell Cell Cell

Miscellaneous:

 If you want to quote single character, use single quotes: a'. In Russian statements use <>. As for the long dashes~--- use these like that. In English statements use these double quotes''. As for the long dashes "--- use these like that. If you want to quote single character, use single quotes: 'a'. In Russian statements use «these double quotes». As for the long dashes — use these like that. In English statements use "these double quotes". As for the long dashes — use these like that. \epigraph{\it{Some inspirational citation...}}{--- Author of citation, \it{Source}} Legend starts here...` Some inspirational citation... — Author of citation, Source Legend starts here...