Package: p2d
Polygon2DOMjudge中文What is thisIt is a simple python script converting polygon package to DOMjudge (kattis) package.Installpipinstallp2dCLI Example# Unzip your polygon-package to /path/to/polygon-package first$p2d--codeA--colorFF0000-o/path/to/domjudge-package/path/to/polygon-packageRun this command to make a package from/path/to/polygon-packageto/path/to/domjudge-package.zipand setcodeandcolor.All available parameters are:--code: problem short name in DOMjudge.--color: problem color in DOMjudge.--default: force use the default output validator.--validator-flags: add some flags to the output validator, only works when--defaultis set.--auto: use the default output validator if the checker is defined in config and can be replaced by the default one.--memory-limit: override the memory limit for DOMjudge package (in MB), default is using the memory limit defined in polygon package.--output-limit: override the output limit for DOMjudge package (in MB), default is using the default output limit in DOMjudge setting.--replace-sample: replace the sample input and output with the one shipped with problem statement (e.g. prevent the sample output is different from the main and correct solution).ConfigInconfig.json, you can change some special checker's validator's flag or add some checker configs manually.Environment VariableDon't change them unless you know what you are doing.CONFIG_PATHTESTLIB_PATHEXTENSION_FOR_DESCAPI Exampleimporttempfilefromp2dimportPolygon2DOMjudgepackage_dir='/path/to/polygon-package'output_file='/path/to/domjudge-package'# without '.zip' suffixwithtempfile.TemporaryDirectory()astemp_dir:try:Polygon2DOMjudge(package_dir,temp_dir,output_file).process()exceptExceptionase:# do somethingpassDevelopment# installpoetryinstall# buildpoetrybuild# run unittestpoetryrunpytest# release./release.sh${yourversion}Polygon2DOMjudge这是什么这是一个简单的将 polygon 题目包转换成 DOMjudge (kattis) 题目包的 python 脚本。安装pipinstallp2d-ihttps://pypi.tuna.tsinghua.edu.cn/simple/命令行使用示例# 首先把你的 polygon-package 解压到 /path/to/polygon-package 位置$./bin/p2d--codeA--colorFF0000-o/path/to/domjudge-package/path/to/polygon-package运行此命令可以从/path/to/polygon-package处的转换题目包为/path/to/domjudge-package.zip，并设置code和color属性。所有可用的命令行参数如下：--code: 题目在 DOMjudge 中的 short name。--color: 题目在 DOMjudge 中的颜色。--default: 强制使用 DOMjudge 默认的输出校验器。--validator-flags: 为输出校验器添加一些命令行参数，仅在--default被设置时生效。--auto: 自动使用 DOMjudge 默认的输出校验器，即如果 checker 在配置文件中被定义，则使用默认的输出校验器与合适的命令行参数替代。--memory-limit: 覆盖 DOMjudge 题目包的内存限制，如果不设置，则使用 Polygon 题目包中的内存限制。--output-limit: 覆盖 DOMjudge 题目包的输出限制，如果不设置，则使用 DOMjudge 设置中默认的输出限制。--replace-sample: 替换样例输入输出，如果样例输入输出与题面中的样例输入输出不同，则使用题面中的样例输入输出替换（例如防止样例输出与正确解答的输出不同）。配置在config.json文件中，你可以设置一些特殊的 checker 的输出校验器参数，并手动添加一些。环境变量某些时候可能会有用。但如果你不知道你在干啥，请不要随便修改。CONFIG_PATHTESTLIB_PATHEXTENSION_FOR_DESCAPI 使用示例importtempfilefromp2dimportPolygon2DOMjudgepackage_dir='/path/to/polygon-package'output_file='/path/to/domjudge-package'# without '.zip' suffixwithtempfile.TemporaryDirectory()astemp_dir:try:Polygon2DOMjudge(package_dir,temp_dir,output_file).process()exceptExceptionase:# do somethingpass开发# installpoetryinstall# buildpoetrybuild# run unittestpoetryrunpytest# release./release.sh${yourversion}