rbx.cp 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rbx/__init__.py +0 -0
- rbx/annotations.py +127 -0
- rbx/autoenum.py +333 -0
- rbx/box/__init__.py +0 -0
- rbx/box/builder.py +77 -0
- rbx/box/cd.py +37 -0
- rbx/box/checkers.py +134 -0
- rbx/box/code.py +185 -0
- rbx/box/compile.py +56 -0
- rbx/box/conftest.py +42 -0
- rbx/box/contest/__init__.py +0 -0
- rbx/box/contest/build_contest_statements.py +347 -0
- rbx/box/contest/contest_package.py +76 -0
- rbx/box/contest/contest_utils.py +20 -0
- rbx/box/contest/main.py +179 -0
- rbx/box/contest/schema.py +155 -0
- rbx/box/contest/statements.py +82 -0
- rbx/box/creation.py +72 -0
- rbx/box/download.py +64 -0
- rbx/box/environment.py +345 -0
- rbx/box/extensions.py +26 -0
- rbx/box/generators.py +478 -0
- rbx/box/generators_test.py +63 -0
- rbx/box/main.py +449 -0
- rbx/box/package.py +316 -0
- rbx/box/packaging/boca/extension.py +27 -0
- rbx/box/packaging/boca/packager.py +245 -0
- rbx/box/packaging/contest_main.py +82 -0
- rbx/box/packaging/main.py +68 -0
- rbx/box/packaging/packager.py +117 -0
- rbx/box/packaging/polygon/packager.py +320 -0
- rbx/box/packaging/polygon/test.py +81 -0
- rbx/box/packaging/polygon/xml_schema.py +106 -0
- rbx/box/presets/__init__.py +503 -0
- rbx/box/presets/fetch.py +70 -0
- rbx/box/presets/lock_schema.py +20 -0
- rbx/box/presets/schema.py +59 -0
- rbx/box/schema.py +394 -0
- rbx/box/solutions.py +792 -0
- rbx/box/solutions_test.py +41 -0
- rbx/box/statements/__init__.py +0 -0
- rbx/box/statements/build_statements.py +359 -0
- rbx/box/statements/builders.py +375 -0
- rbx/box/statements/joiners.py +113 -0
- rbx/box/statements/latex.py +47 -0
- rbx/box/statements/latex_jinja.py +214 -0
- rbx/box/statements/schema.py +138 -0
- rbx/box/stresses.py +292 -0
- rbx/box/stressing/__init__.py +0 -0
- rbx/box/stressing/finder_parser.py +359 -0
- rbx/box/stressing/generator_parser.py +258 -0
- rbx/box/testcases.py +54 -0
- rbx/box/ui/__init__.py +0 -0
- rbx/box/ui/captured_log.py +372 -0
- rbx/box/ui/css/app.tcss +48 -0
- rbx/box/ui/main.py +38 -0
- rbx/box/ui/run.py +209 -0
- rbx/box/validators.py +245 -0
- rbx/box/validators_test.py +15 -0
- rbx/checker.py +128 -0
- rbx/clone.py +197 -0
- rbx/config.py +271 -0
- rbx/conftest.py +38 -0
- rbx/console.py +27 -0
- rbx/create.py +37 -0
- rbx/edit.py +24 -0
- rbx/grading/__init__.py +0 -0
- rbx/grading/caching.py +356 -0
- rbx/grading/conftest.py +33 -0
- rbx/grading/judge/__init__.py +0 -0
- rbx/grading/judge/cacher.py +503 -0
- rbx/grading/judge/digester.py +35 -0
- rbx/grading/judge/sandbox.py +748 -0
- rbx/grading/judge/sandboxes/__init__.py +0 -0
- rbx/grading/judge/sandboxes/isolate.py +683 -0
- rbx/grading/judge/sandboxes/stupid_sandbox.py +310 -0
- rbx/grading/judge/sandboxes/timeit.py +217 -0
- rbx/grading/judge/storage.py +284 -0
- rbx/grading/judge/test.py +38 -0
- rbx/grading/judge/testiso.py +54 -0
- rbx/grading/steps.py +522 -0
- rbx/grading/steps_with_caching.py +59 -0
- rbx/grading/steps_with_caching_run_test.py +429 -0
- rbx/grading_utils.py +148 -0
- rbx/hydration.py +101 -0
- rbx/main.py +122 -0
- rbx/metadata.py +105 -0
- rbx/providers/__init__.py +43 -0
- rbx/providers/codeforces.py +73 -0
- rbx/providers/provider.py +26 -0
- rbx/resources/checkers/boilerplate.cpp +20 -0
- rbx/resources/default_config.json +48 -0
- rbx/resources/envs/default.rbx.yml +37 -0
- rbx/resources/envs/isolate.rbx.yml +37 -0
- rbx/resources/packagers/boca/checker.sh +43 -0
- rbx/resources/packagers/boca/compare +53 -0
- rbx/resources/packagers/boca/compile/c +172 -0
- rbx/resources/packagers/boca/compile/cc +173 -0
- rbx/resources/packagers/boca/compile/cpp +172 -0
- rbx/resources/packagers/boca/compile/java +194 -0
- rbx/resources/packagers/boca/compile/kt +155 -0
- rbx/resources/packagers/boca/compile/pas +172 -0
- rbx/resources/packagers/boca/compile/py2 +173 -0
- rbx/resources/packagers/boca/compile/py3 +173 -0
- rbx/resources/packagers/boca/run/c +128 -0
- rbx/resources/packagers/boca/run/cc +128 -0
- rbx/resources/packagers/boca/run/cpp +128 -0
- rbx/resources/packagers/boca/run/java +194 -0
- rbx/resources/packagers/boca/run/kt +159 -0
- rbx/resources/packagers/boca/run/py2 +166 -0
- rbx/resources/packagers/boca/run/py3 +166 -0
- rbx/resources/presets/default/contest/contest.rbx.yml +14 -0
- rbx/resources/presets/default/contest/statement/contest.rbx.tex +97 -0
- rbx/resources/presets/default/contest/statement/olymp.sty +250 -0
- rbx/resources/presets/default/contest/statement/template.rbx.tex +42 -0
- rbx/resources/presets/default/preset.rbx.yml +12 -0
- rbx/resources/presets/default/problem/.gitignore +6 -0
- rbx/resources/presets/default/problem/gen.cpp +9 -0
- rbx/resources/presets/default/problem/problem.rbx.yml +44 -0
- rbx/resources/presets/default/problem/random.py +3 -0
- rbx/resources/presets/default/problem/random.txt +2 -0
- rbx/resources/presets/default/problem/sols/main.cpp +9 -0
- rbx/resources/presets/default/problem/sols/slow.cpp +15 -0
- rbx/resources/presets/default/problem/sols/wa.cpp +9 -0
- rbx/resources/presets/default/problem/statement/olymp.sty +250 -0
- rbx/resources/presets/default/problem/statement/projecao.png +0 -0
- rbx/resources/presets/default/problem/statement/statement.rbx.tex +18 -0
- rbx/resources/presets/default/problem/statement/template.rbx.tex +89 -0
- rbx/resources/presets/default/problem/tests/samples/000.in +1 -0
- rbx/resources/presets/default/problem/tests/samples/001.in +1 -0
- rbx/resources/presets/default/problem/validator.cpp +16 -0
- rbx/resources/presets/default/problem/wcmp.cpp +34 -0
- rbx/resources/templates/template.cpp +19 -0
- rbx/run.py +45 -0
- rbx/schema.py +64 -0
- rbx/submit.py +61 -0
- rbx/submitors/__init__.py +18 -0
- rbx/submitors/codeforces.py +120 -0
- rbx/submitors/submitor.py +25 -0
- rbx/test.py +347 -0
- rbx/testcase.py +70 -0
- rbx/testcase_rendering.py +79 -0
- rbx/testdata/box1/gen1.cpp +7 -0
- rbx/testdata/box1/gen2.cpp +9 -0
- rbx/testdata/box1/genScript.py +2 -0
- rbx/testdata/box1/hard-tle.sol.cpp +26 -0
- rbx/testdata/box1/ole.cpp +17 -0
- rbx/testdata/box1/problem.rbx.yml +39 -0
- rbx/testdata/box1/re.sol.cpp +23 -0
- rbx/testdata/box1/sol.cpp +22 -0
- rbx/testdata/box1/tests/1.in +1 -0
- rbx/testdata/box1/tle-and-incorrect.sol.cpp +33 -0
- rbx/testdata/box1/tle.sol.cpp +35 -0
- rbx/testdata/box1/validator.cpp +11 -0
- rbx/testdata/box1/wa.sol.cpp +22 -0
- rbx/testdata/caching/executable.py +1 -0
- rbx/testdata/compatible +0 -0
- rbx/testing_utils.py +65 -0
- rbx/utils.py +162 -0
- rbx_cp-0.5.0.dist-info/LICENSE +201 -0
- rbx_cp-0.5.0.dist-info/METADATA +89 -0
- rbx_cp-0.5.0.dist-info/RECORD +164 -0
- rbx_cp-0.5.0.dist-info/WHEEL +4 -0
- rbx_cp-0.5.0.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
% Copyright (c) 2005-2013 Olymp.sty Developers Group.
|
2
|
+
% See https://github.com/GassaFM/olymp.sty/blob/master/AUTHORS
|
3
|
+
% for the complete list of authors.
|
4
|
+
|
5
|
+
%\ProvidesPackage{olymp}
|
6
|
+
\usepackage{verbatim}
|
7
|
+
\usepackage{xstring}
|
8
|
+
|
9
|
+
% \makeatletter
|
10
|
+
% \newcommand\FirstWord[1]{\@firstword#1 \@nil}%
|
11
|
+
% \def\@firstword#1 #2\@nil{\@removecomma#1,\@nil}%
|
12
|
+
% \def\@removecomma#1,#2\@nil{\@removeperiod#1.\@nil}
|
13
|
+
% \def\@removeperiod#1.#2\@nil{\@removesemicolon#1;\@nil}
|
14
|
+
% \def\@removesemicolon#1;#2\@nil{#1}
|
15
|
+
% \makeatother
|
16
|
+
\newcommand\FirstWord[1]{#1}
|
17
|
+
|
18
|
+
\ProcessOptions\relax
|
19
|
+
|
20
|
+
\setlength{\parindent}{0pt}
|
21
|
+
\setlength{\parskip}{0.8em}
|
22
|
+
|
23
|
+
% contest keywords definitions
|
24
|
+
\def\conProblemTutorial{Problem Tutorial}
|
25
|
+
\def\conProblem{Problem}
|
26
|
+
\def\conProblemAuthor{Author:}
|
27
|
+
\def\conProblemDeveloper{Developer:}
|
28
|
+
\def\conProblemOrigin{Origin:}
|
29
|
+
\def\conInputFileName{Input file:}
|
30
|
+
\def\conOutputFileName{Output file:}
|
31
|
+
\def\conTimeLimit{Time limit:}
|
32
|
+
\def\conMemoryLimit{Memory limit:}
|
33
|
+
\def\conFeedback{Feedback:}
|
34
|
+
\def\constdin{standard input}
|
35
|
+
\def\constdout{standard output}
|
36
|
+
\def\conSpecification{Specification}
|
37
|
+
\def\conInteraction{Interaction Protocol}
|
38
|
+
\def\conInput{Input}
|
39
|
+
\def\conOutput{Output}
|
40
|
+
\def\conExample{Example}
|
41
|
+
\def\conExamples{Examples}
|
42
|
+
\def\conExampleNotes{Notes}
|
43
|
+
\def\conExplanation{Explanation}
|
44
|
+
\def\conExplanations{Explanations}
|
45
|
+
\def\conIllustration{Illustration}
|
46
|
+
\def\conScoring{Scoring}
|
47
|
+
\def\conNote{Note}
|
48
|
+
\def\conNotes{Notes}
|
49
|
+
\def\conConstraints{Constraints}
|
50
|
+
\def\conversion{version}
|
51
|
+
\def\conrevision{revision}
|
52
|
+
\def\conSubtaskOne{Subtask 1}
|
53
|
+
\def\conSubtaskTwo{Subtask 2}
|
54
|
+
\def\conSubtaskThree{Subtask 3}
|
55
|
+
\def\conSubtaskFour{Subtask 4}
|
56
|
+
\def\conSubtaskFive{Subtask 5}
|
57
|
+
\def\conSubtaskSix{Subtask 6}
|
58
|
+
\def\conSubtask{Subtask}
|
59
|
+
\def\conpoints{points}
|
60
|
+
\def\conPage{Page}
|
61
|
+
\def\conof{of}
|
62
|
+
\def\connotstated{not stated}
|
63
|
+
\def\conIntentionallyBlankPage{This page is intentionally left blank}
|
64
|
+
\def\conTimeSuffix{s}
|
65
|
+
\def\conMemorySufix{mb}
|
66
|
+
|
67
|
+
% fancyhdr
|
68
|
+
|
69
|
+
% font
|
70
|
+
|
71
|
+
\newcommand{\afterfrontpage}{
|
72
|
+
\vspace*{\fill}
|
73
|
+
\begin{center}
|
74
|
+
\problemheadfont\conIntentionallyBlankPage
|
75
|
+
\end{center}
|
76
|
+
\vspace*{\fill}
|
77
|
+
\clearpage
|
78
|
+
}
|
79
|
+
\newcommand{\problemheadfont}{\LARGE}
|
80
|
+
\newcommand{\problemsectionfont}{\Large}
|
81
|
+
\newcommand{\problemtextfont}{\normalsize}
|
82
|
+
\newcommand{\beforeproblemsectioncaption}{\smallbreak\smallskip}
|
83
|
+
\newcommand{\afterproblemsectioncaption}{\smallskip}
|
84
|
+
\newcommand{\problemend}{
|
85
|
+
\clearpage
|
86
|
+
\ifintentionallyblankpages
|
87
|
+
\ifodd\value{page}
|
88
|
+
\else
|
89
|
+
\afterfrontpage
|
90
|
+
\fi
|
91
|
+
\fi
|
92
|
+
}
|
93
|
+
\def\presectionspacing{\hspace{3mm}}
|
94
|
+
|
95
|
+
% section commands from olymp
|
96
|
+
|
97
|
+
\newcommand{\createsection}{\@newsection}
|
98
|
+
|
99
|
+
\def\@newsection#1#2{\DeclareRobustCommand{#1}{
|
100
|
+
{\beforeproblemsectioncaption\bf\problemsectionfont\presectionspacing{#2}}
|
101
|
+
\nopagebreak\par\afterproblemsectioncaption}
|
102
|
+
}
|
103
|
+
|
104
|
+
\newcommand{\createsectionpar}{\@newsectionpar}
|
105
|
+
|
106
|
+
\def\@newsectionpar#1#2{\DeclareRobustCommand{#1}[1]{
|
107
|
+
{\beforeproblemsectioncaption\bf\problemsectionfont{#2~##1}}
|
108
|
+
\nopagebreak\par\afterproblemsectioncaption}
|
109
|
+
}
|
110
|
+
|
111
|
+
\newcommand{\createsectionpartwo}{\@newsectionpartwo}
|
112
|
+
|
113
|
+
\def\@newsectionpartwo#1#2#3{\DeclareRobustCommand{#1}[2]{
|
114
|
+
{\beforeproblemsectioncaption\problemsectionfont{\textbf{#2}~\textbf{##1}~(##2~#3)}}
|
115
|
+
\nopagebreak\par\afterproblemsectioncaption}
|
116
|
+
}
|
117
|
+
|
118
|
+
\createsection{\Instructions}{\conInstructions}
|
119
|
+
\createsection{\Specification}{\conSpecification}
|
120
|
+
\createsection{\Interaction}{\conInteraction}
|
121
|
+
\createsection{\InputFile}{\conInput}
|
122
|
+
\createsection{\OutputFile}{\conOutput}
|
123
|
+
\createsection{\Example}{\conExample}
|
124
|
+
\createsection{\Examples}{\conExamples}
|
125
|
+
\createsection{\Explanation}{\conExplanation}
|
126
|
+
\createsection{\Explanations}{\conExplanations}
|
127
|
+
\createsection{\Illustration}{\conIllustration}
|
128
|
+
\createsection{\Scoring}{\conScoring}
|
129
|
+
\createsection{\Note}{\conNote}
|
130
|
+
\createsection{\Notes}{\conNotes}
|
131
|
+
\createsection{\Constraints}{\conConstraints}
|
132
|
+
\createsection{\SubtaskOne}{\conSubtaskOne}
|
133
|
+
\createsection{\SubtaskTwo}{\conSubtaskTwo}
|
134
|
+
\createsection{\SubtaskThree}{\conSubtaskThree}
|
135
|
+
\createsection{\SubtaskFour}{\conSubtaskFour}
|
136
|
+
\createsection{\SubtaskFive}{\conSubtaskFive}
|
137
|
+
\createsection{\SubtaskSix}{\conSubtaskSix}
|
138
|
+
\createsectionpar{\Subtask}{\conSubtask}
|
139
|
+
\createsectionpartwo{\SubtaskWithCost}{\conSubtask}{\conpoints}
|
140
|
+
\createsection{\Editorial}{\conEditorial}
|
141
|
+
|
142
|
+
% frontpage
|
143
|
+
\newenvironment{frontpage}[3]{
|
144
|
+
\thispagestyle{empty}
|
145
|
+
{\centering
|
146
|
+
\noindent\rule{18cm}{0.4pt}
|
147
|
+
|
148
|
+
\vspace{1cm}
|
149
|
+
%\includegraphics[width=0.15\textwidth]{example-image-1x1}\par\vspace{1cm}
|
150
|
+
{\LARGE #1\par}
|
151
|
+
%\vspace{1cm}
|
152
|
+
{\Large #2\par}
|
153
|
+
\vspace{1cm}}
|
154
|
+
\def\thisFrontPageDate{#3}
|
155
|
+
\Instructions
|
156
|
+
}{
|
157
|
+
\vspace*{\fill}
|
158
|
+
\centering{\Large \thisFrontPageDate\par}
|
159
|
+
\centering\noindent\rule{18cm}{0.4pt}
|
160
|
+
\newpage
|
161
|
+
}
|
162
|
+
|
163
|
+
% problem
|
164
|
+
\newcounter{ProblemCounter}
|
165
|
+
|
166
|
+
\newenvironment{problem}[6][]{
|
167
|
+
|
168
|
+
\def\ProblemLetter{#1}
|
169
|
+
\stepcounter{ProblemCounter}
|
170
|
+
\begin{center}
|
171
|
+
\ifx\ProblemLetter\empty
|
172
|
+
\else
|
173
|
+
\problemtextfont\textbf{\conProblem\ \ProblemLetter} \\
|
174
|
+
\fi
|
175
|
+
\problemheadfont\textsf{#2} \\
|
176
|
+
\ifx#5\empty
|
177
|
+
\else
|
178
|
+
\problemtextfont{\conTimeLimit\ #5} \\
|
179
|
+
\fi
|
180
|
+
\ifx#6\empty
|
181
|
+
\else
|
182
|
+
\problemtextfont{\conMemoryLimit\ #6} \\
|
183
|
+
\fi
|
184
|
+
%\problemtextfont{\conSourceFileName\ \ProblemLetter\ \conSourceExts} \\
|
185
|
+
\vspace{0.3cm}
|
186
|
+
\noindent\rule{16cm}{0.4pt}
|
187
|
+
\end{center}
|
188
|
+
\problemtextfont
|
189
|
+
\newcommand{\InputFileName}{#3}
|
190
|
+
\newcommand{\OutputFileName}{#4}
|
191
|
+
}{\problemend}
|
192
|
+
|
193
|
+
% examples
|
194
|
+
% -- Setup sizes --
|
195
|
+
\newlength{\thelinewidth}
|
196
|
+
\newlength{\exmpwidinf}
|
197
|
+
\newlength{\exmpwidouf}
|
198
|
+
\newlength{\exmpwidewid}
|
199
|
+
\newlength{\exmpthreewidinf}
|
200
|
+
\newlength{\exmpthreewidouf}
|
201
|
+
\newlength{\exmpthreewidnote}
|
202
|
+
|
203
|
+
\thelinewidth=\textwidth
|
204
|
+
\exmpwidinf=0.43\thelinewidth
|
205
|
+
\exmpwidouf=0.43\thelinewidth
|
206
|
+
\exmpwidewid=0.9\thelinewidth
|
207
|
+
\exmpthreewidinf=0.28\thelinewidth
|
208
|
+
\exmpthreewidouf=0.28\thelinewidth
|
209
|
+
\exmpthreewidnote=0.30\thelinewidth
|
210
|
+
|
211
|
+
\def\s@tm@cr@s{
|
212
|
+
\def\widthin##1{\exmpwidinf=##1\relax}
|
213
|
+
\def\widthout##1{\exmpwidouf=##1\relax}
|
214
|
+
\def\stretchin##1{\advance\exmpwidinf by ##1\relax}
|
215
|
+
\def\stretchout##1{\advance\exmpwidouf by ##1\relax}
|
216
|
+
\@ifstar{
|
217
|
+
\error Star must not be used in example environment any more
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
% This is magic, which delete space after verbatiminput
|
222
|
+
\addto@hook{\every@verbatim}{\topsep=0pt\relax}
|
223
|
+
|
224
|
+
\newenvironment{example}[1][]{
|
225
|
+
\s@tm@cr@s#1
|
226
|
+
\ttfamily\obeyspaces\obeylines\frenchspacing
|
227
|
+
\newcommand{\exmp}[2]{
|
228
|
+
\begin{minipage}[t]{\exmpwidinf}\rightskip=0pt plus 1fill\relax##1\medskip\end{minipage}&
|
229
|
+
\begin{minipage}[t]{\exmpwidouf}\rightskip=0pt plus 1fill\relax##2\medskip\end{minipage}\\
|
230
|
+
\hline
|
231
|
+
}
|
232
|
+
|
233
|
+
\newcommand{\exmpfile}[2]{
|
234
|
+
\exmp{
|
235
|
+
\verbatiminput{##1}
|
236
|
+
}{
|
237
|
+
\verbatiminput{##2}
|
238
|
+
}%
|
239
|
+
}
|
240
|
+
|
241
|
+
\begin{center}
|
242
|
+
\begin{tabular}{|l|l|}
|
243
|
+
\hline
|
244
|
+
\multicolumn{1}{|c|}{\bf\texttt{\textbf{\InputFileName}}} &
|
245
|
+
\multicolumn{1}{|c|}{\bf\texttt{\textbf{\OutputFileName}}} \\
|
246
|
+
\hline
|
247
|
+
}{
|
248
|
+
\end{tabular}
|
249
|
+
\end{center}
|
250
|
+
}
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%- block legend
|
2
|
+
Dado dois números inteiros $A$ e $B$, determine o valor de $A + B$.
|
3
|
+
|
4
|
+
\includegraphics[width=6cm]{projecao.png}
|
5
|
+
%- endblock
|
6
|
+
|
7
|
+
%- block input
|
8
|
+
A entrada é composta por uma única linha contendo dois números
|
9
|
+
inteiros $A$ e $B$ ($1 \leq A, B \leq \VAR{vars.MAX_N | sci}$).
|
10
|
+
%- endblock
|
11
|
+
|
12
|
+
%- block output
|
13
|
+
A saída deve conter somente um único inteiro, a soma de $A$ e $B$.
|
14
|
+
%- endblock
|
15
|
+
|
16
|
+
%- block notes
|
17
|
+
Sem muitas notas pra este problema.
|
18
|
+
%- endblock
|
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
\documentclass[titlepage, oneside, a4paper]{article}
|
3
|
+
|
4
|
+
\usepackage {import}
|
5
|
+
\usepackage[margin=25mm, left=17mm, right=17mm]{geometry}
|
6
|
+
\usepackage[utf8]{inputenc}
|
7
|
+
\usepackage[english]{babel}
|
8
|
+
\usepackage{amsmath}
|
9
|
+
\usepackage{amssymb}
|
10
|
+
\usepackage{fancyhdr}
|
11
|
+
\usepackage{comment}
|
12
|
+
\usepackage{olymp}
|
13
|
+
\usepackage{epigraph}
|
14
|
+
\usepackage{expdlist}
|
15
|
+
\usepackage{graphicx}
|
16
|
+
\usepackage{ulem}
|
17
|
+
\usepackage{lastpage}
|
18
|
+
|
19
|
+
%- if problem.blocks.preamble is defined
|
20
|
+
\VAR{problem.blocks.preamble}
|
21
|
+
%- endif
|
22
|
+
|
23
|
+
\def\showSourceFileName{1}
|
24
|
+
\newif\ifintentionallyblankpages % comment this out to add blank pages
|
25
|
+
|
26
|
+
\pagestyle{fancy}
|
27
|
+
\fancyhf{}
|
28
|
+
\renewcommand{\footrulewidth}{0.4pt}
|
29
|
+
|
30
|
+
\title{}
|
31
|
+
\author{}
|
32
|
+
\date{}
|
33
|
+
|
34
|
+
\makeatletter
|
35
|
+
\let\newtitle\@title
|
36
|
+
\let\newauthor\@author
|
37
|
+
\let\newdate\@date
|
38
|
+
\makeatother
|
39
|
+
|
40
|
+
\rhead{\newtitle}
|
41
|
+
\lhead{\newauthor}
|
42
|
+
\lfoot{\newdate}
|
43
|
+
\rfoot{\thepage}
|
44
|
+
|
45
|
+
\begin{document}
|
46
|
+
|
47
|
+
\begin{problem}
|
48
|
+
%- if problem.short_name is defined
|
49
|
+
[\VAR{problem.short_name}]
|
50
|
+
%- endif
|
51
|
+
{\VAR{problem.title | escape}}
|
52
|
+
{stdin}
|
53
|
+
{stdout}
|
54
|
+
{\VAR{problem.package.timeLimit / 1000 | round(1, 'floor')} s}
|
55
|
+
{\VAR{problem.package.memoryLimit} MB}
|
56
|
+
|
57
|
+
\VAR{problem.blocks.legend}
|
58
|
+
|
59
|
+
%- if problem.blocks.input is defined
|
60
|
+
\InputFile
|
61
|
+
\VAR{problem.blocks.input}
|
62
|
+
%- endif
|
63
|
+
|
64
|
+
%- if problem.blocks.output is defined
|
65
|
+
\OutputFile
|
66
|
+
\VAR{problem.blocks.output}
|
67
|
+
%- endif
|
68
|
+
|
69
|
+
\Examples
|
70
|
+
|
71
|
+
%- for sample in problem.samples
|
72
|
+
\begin{example}
|
73
|
+
\exmpfile{\VAR{sample.inputPath}}{\VAR{sample.outputPath if sample.outputPath is not none else ''}}%
|
74
|
+
\end{example}
|
75
|
+
%- endfor
|
76
|
+
|
77
|
+
%- if problem.blocks.notes is defined
|
78
|
+
\Notes
|
79
|
+
\VAR{problem.blocks.notes}
|
80
|
+
%- endif
|
81
|
+
|
82
|
+
%- if problem.blocks.editorial is defined
|
83
|
+
\Editorial
|
84
|
+
\VAR{problem.blocks.editorial}
|
85
|
+
%- endif
|
86
|
+
|
87
|
+
\end{problem}
|
88
|
+
|
89
|
+
\end{document}
|
@@ -0,0 +1 @@
|
|
1
|
+
3 7
|
@@ -0,0 +1 @@
|
|
1
|
+
123456789 123456789
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#include "testlib.h"
|
2
|
+
|
3
|
+
using namespace std;
|
4
|
+
|
5
|
+
int main(int argc, char *argv[]) {
|
6
|
+
registerValidation(argc, argv);
|
7
|
+
prepareOpts(argc, argv);
|
8
|
+
|
9
|
+
int MAX_N = opt<int>("MAX_N"); // Read from package vars.
|
10
|
+
|
11
|
+
inf.readInt(1, MAX_N, "A");
|
12
|
+
inf.readSpace();
|
13
|
+
inf.readInt(1, MAX_N, "B");
|
14
|
+
inf.readEoln();
|
15
|
+
inf.readEof();
|
16
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#include "testlib.h"
|
2
|
+
|
3
|
+
using namespace std;
|
4
|
+
|
5
|
+
int main(int argc, char *argv[]) {
|
6
|
+
setName("compare sequences of tokens");
|
7
|
+
registerTestlibCmd(argc, argv);
|
8
|
+
|
9
|
+
int n = 0;
|
10
|
+
string j, p;
|
11
|
+
|
12
|
+
while (!ans.seekEof() && !ouf.seekEof()) {
|
13
|
+
n++;
|
14
|
+
|
15
|
+
ans.readWordTo(j);
|
16
|
+
ouf.readWordTo(p);
|
17
|
+
|
18
|
+
if (j != p)
|
19
|
+
quitf(_wa, "%d%s words differ - expected: '%s', found: '%s'", n, englishEnding(n).c_str(),
|
20
|
+
compress(j).c_str(), compress(p).c_str());
|
21
|
+
}
|
22
|
+
|
23
|
+
if (ans.seekEof() && ouf.seekEof()) {
|
24
|
+
if (n == 1)
|
25
|
+
quitf(_ok, "\"%s\"", compress(j).c_str());
|
26
|
+
else
|
27
|
+
quitf(_ok, "%d tokens", n);
|
28
|
+
} else {
|
29
|
+
if (ans.seekEof())
|
30
|
+
quitf(_wa, "Participant output contains extra tokens");
|
31
|
+
else
|
32
|
+
quitf(_wa, "Unexpected EOF in the participants output");
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#include <bits/stdc++.h>
|
2
|
+
|
3
|
+
using namespace std;
|
4
|
+
{% if problem_test_type == 'multiNumber' %}
|
5
|
+
void solve(int tn) {
|
6
|
+
|
7
|
+
}
|
8
|
+
{% endif %}
|
9
|
+
int32_t main()
|
10
|
+
{
|
11
|
+
ios::sync_with_stdio(false);
|
12
|
+
cin.tie(0);
|
13
|
+
{% if problem_test_type == 'multiNumber' %}
|
14
|
+
int T;
|
15
|
+
cin >> T;
|
16
|
+
for (int i = 1; i <= T; i++)
|
17
|
+
solve(i);
|
18
|
+
{% endif %}
|
19
|
+
}
|
rbx/run.py
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
import atexit
|
2
|
+
import os
|
3
|
+
import shlex
|
4
|
+
|
5
|
+
from rbx import annotations, grading_utils, metadata
|
6
|
+
from rbx.config import get_config
|
7
|
+
from rbx.console import stderr_console
|
8
|
+
from rbx.grading import steps
|
9
|
+
from rbx.grading.judge.sandboxes import stupid_sandbox
|
10
|
+
|
11
|
+
|
12
|
+
def main(
|
13
|
+
problem: annotations.Problem,
|
14
|
+
language: annotations.LanguageWithDefault = None,
|
15
|
+
keep_sandbox: bool = False,
|
16
|
+
):
|
17
|
+
dumped_problem = metadata.find_problem_by_anything(problem)
|
18
|
+
if not dumped_problem:
|
19
|
+
stderr_console.print(
|
20
|
+
f'[error]Problem with identifier [item]{problem}[/item] not found.[/error]'
|
21
|
+
)
|
22
|
+
return
|
23
|
+
|
24
|
+
lang = get_config().get_language(language)
|
25
|
+
if not lang:
|
26
|
+
stderr_console.print(
|
27
|
+
f'[error]Language {language or get_config().defaultLanguage} not found in config. Please check your configuration.[/error]'
|
28
|
+
)
|
29
|
+
return
|
30
|
+
|
31
|
+
box = stupid_sandbox.StupidSandbox()
|
32
|
+
atexit.register(lambda: box.cleanup(delete=not keep_sandbox))
|
33
|
+
|
34
|
+
preprocess_cmds = grading_utils.build_preprocess_commands(dumped_problem, lang)
|
35
|
+
sandbox_params = grading_utils.build_preprocess_sandbox_params()
|
36
|
+
artifacts = grading_utils.build_compile_grading_artifacts(dumped_problem, lang)
|
37
|
+
|
38
|
+
if not steps.compile(preprocess_cmds, sandbox_params, box, artifacts):
|
39
|
+
stderr_console.print(
|
40
|
+
f'[error]Failed to preprocess problem [item]{dumped_problem.pretty_name()}[/item].[/error]'
|
41
|
+
)
|
42
|
+
return
|
43
|
+
|
44
|
+
cmd = shlex.split(lang.exec)
|
45
|
+
os.execv(cmd[0], cmd)
|
rbx/schema.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import uuid
|
2
|
+
from typing import Dict, List, Optional
|
3
|
+
|
4
|
+
from pydantic import BaseModel
|
5
|
+
|
6
|
+
from rbx import utils
|
7
|
+
|
8
|
+
|
9
|
+
class Testcase(BaseModel):
|
10
|
+
input: str
|
11
|
+
output: str
|
12
|
+
|
13
|
+
|
14
|
+
class Batch(BaseModel):
|
15
|
+
id: str
|
16
|
+
size: int
|
17
|
+
|
18
|
+
@staticmethod
|
19
|
+
def create():
|
20
|
+
return Batch(id=str(uuid.uuid4()), size=1)
|
21
|
+
|
22
|
+
|
23
|
+
class Problem(BaseModel):
|
24
|
+
name: str
|
25
|
+
group: str = ''
|
26
|
+
url: str = ''
|
27
|
+
interactive: bool = False
|
28
|
+
memoryLimit: int
|
29
|
+
timeLimit: int
|
30
|
+
tests: List[Testcase] = []
|
31
|
+
testType: str = 'single'
|
32
|
+
batch: Batch
|
33
|
+
|
34
|
+
def get_code(self):
|
35
|
+
return self.get_normalized_name()
|
36
|
+
|
37
|
+
def get_normalized_name(self) -> str:
|
38
|
+
return utils.normalize_with_underscores(self.name)
|
39
|
+
|
40
|
+
|
41
|
+
class DumpedProblem(Problem):
|
42
|
+
code: str
|
43
|
+
aliases: List[str]
|
44
|
+
checker: Optional[str] = None
|
45
|
+
|
46
|
+
@staticmethod
|
47
|
+
def from_problem(problem: Problem, **kwargs) -> 'DumpedProblem':
|
48
|
+
return DumpedProblem(**problem.model_dump(), **kwargs)
|
49
|
+
|
50
|
+
def pretty_name(self) -> str:
|
51
|
+
if self.name == self.code:
|
52
|
+
return self.name
|
53
|
+
return f'{self.name} ({self.code})'
|
54
|
+
|
55
|
+
def get_vars(self) -> Dict[str, str]:
|
56
|
+
return {
|
57
|
+
'problem_name': self.name,
|
58
|
+
'problem_code': self.code,
|
59
|
+
'problem_url': self.url,
|
60
|
+
'problem_contest': self.group,
|
61
|
+
'problem_time_limit': f'{self.timeLimit}ms',
|
62
|
+
'problem_memory_limit': f'{self.memoryLimit}MB',
|
63
|
+
'problem_test_type': self.testType,
|
64
|
+
}
|
rbx/submit.py
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
import atexit
|
2
|
+
from pathlib import PosixPath
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from rbx import annotations, grading_utils, metadata, submitors, utils
|
6
|
+
from rbx.config import get_config
|
7
|
+
from rbx.console import console
|
8
|
+
from rbx.grading import steps
|
9
|
+
from rbx.grading.judge.sandboxes import stupid_sandbox
|
10
|
+
|
11
|
+
|
12
|
+
def main(
|
13
|
+
problem: annotations.Problem,
|
14
|
+
language: Optional[annotations.LanguageWithDefault] = None,
|
15
|
+
keep_sandbox: bool = False,
|
16
|
+
):
|
17
|
+
dumped_problem = metadata.find_problem_by_anything(problem)
|
18
|
+
if not dumped_problem:
|
19
|
+
console.print(
|
20
|
+
f'[error]Problem with identifier [item]{problem}[/item] not found.[/error]'
|
21
|
+
)
|
22
|
+
return
|
23
|
+
|
24
|
+
lang = get_config().get_language(language)
|
25
|
+
if not lang:
|
26
|
+
console.print(
|
27
|
+
f'[error]Language {language or get_config().defaultLanguage} not found in config. Please check your configuration.[/error]'
|
28
|
+
)
|
29
|
+
return
|
30
|
+
|
31
|
+
box = stupid_sandbox.StupidSandbox()
|
32
|
+
atexit.register(lambda: box.cleanup(delete=not keep_sandbox))
|
33
|
+
|
34
|
+
with console.status(
|
35
|
+
f'Preprocessing problem [item]{dumped_problem.pretty_name()}[/item]...'
|
36
|
+
):
|
37
|
+
preprocess_cmds = grading_utils.build_preprocess_commands(dumped_problem, lang)
|
38
|
+
sandbox_params = grading_utils.build_preprocess_sandbox_params()
|
39
|
+
artifacts = grading_utils.build_compile_grading_artifacts(dumped_problem, lang)
|
40
|
+
if not steps.compile(preprocess_cmds, sandbox_params, box, artifacts):
|
41
|
+
console.print(
|
42
|
+
f'[error]Failed to preprocess problem [item]{dumped_problem.pretty_name()}[/item].[/error]'
|
43
|
+
)
|
44
|
+
return
|
45
|
+
|
46
|
+
submit_file = PosixPath(lang.get_submit_file(dumped_problem.code))
|
47
|
+
console.print(
|
48
|
+
f'Problem to be submitted: [item]{dumped_problem.pretty_name()}[/item]'
|
49
|
+
)
|
50
|
+
console.print(f'Submission file: {submit_file.absolute()}')
|
51
|
+
|
52
|
+
if not utils.confirm_on_status(
|
53
|
+
None, 'Do you want to submit this problem?', default=False
|
54
|
+
):
|
55
|
+
console.print('Skipping submission.')
|
56
|
+
return
|
57
|
+
|
58
|
+
if submitors.handle_submit(submit_file, dumped_problem, lang):
|
59
|
+
console.print('[green]Submission successful.[/green]')
|
60
|
+
else:
|
61
|
+
console.print('[error]Submission failed.[/error]')
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import pathlib
|
2
|
+
|
3
|
+
from rbx.config import Language, get_config
|
4
|
+
from rbx.schema import Problem
|
5
|
+
from rbx.submitors.codeforces import CodeforcesSubmitor
|
6
|
+
|
7
|
+
_SUBMITORS = [CodeforcesSubmitor()]
|
8
|
+
|
9
|
+
|
10
|
+
def handle_submit(file: pathlib.Path, problem: Problem, lang: Language) -> bool:
|
11
|
+
for submitor in _SUBMITORS:
|
12
|
+
if submitor.should_handle(problem):
|
13
|
+
submitor_config = get_config().submitor[lang.submitor]
|
14
|
+
credentials = get_config().credentials[submitor.key()]
|
15
|
+
return submitor.submit(
|
16
|
+
file, problem, submitor_config[submitor.key()], credentials
|
17
|
+
)
|
18
|
+
return False
|