woj-server/resource/runner/problem/example
2024-03-13 20:05:00 +08:00
..
data feat: merge woj-runner resources 2022-10-20 18:21:11 +08:00
judge feat: switch to nsjail 2024-03-13 20:05:00 +08:00
.gitignore feat: merge woj-runner resources 2022-10-20 18:21:11 +08:00
config.json feat: add support for python3(pypy3) and rust 2024-01-30 20:57:17 +08:00
description.md chore: example: add Tags field 2023-12-31 16:07:59 +08:00
README.md feat: add support for python3(pypy3) and rust 2024-01-30 20:57:17 +08:00

示例题目

文件构成

.
├── config.json            # 题目配置信息
├── description.md         # (optional) 题目描述,必须通过 API 提交,使用 import 脚本时将读取该文件
├── data                   # 数据目录
│   ├── input              # 输入数据
│   │   ├── (x).input      # 第 x 组输入数据
│   │   └── ...
│   └── output             # 输出数据
│       ├── (x).output     # 第 x 组输出数据
│       └── ...
└── judge                  # 评测脚本目录
    ├── c.Makefile         # (optional) 自定义评测脚本
    ├── prebuild.Makefile  # (optional) 题目初始化脚本
    └── ...                # 其余可能用到的程序、脚本等

详细说明

题目配置信息

{
    // 支持的语言
    "Languages": [
        {
            // C 语言
            "Lang"   : "c",
            // 使用自定义评测脚本,脚本为 ./judge/custom.MakefileCmp 将被忽略
            "Judge"  : {"Type": "custom", "Script": "custom.Makefile", "Cmp": ""},
            // 运行时配置:时间(ms) 内存(MB) 进/线程数目
            "Runtime": {
                // 编译阶段,可选,默认值见下
                "Compile": {"TimeLimit": 60000, "MemoryLimit": 256, "NProcLimit": 64},
                // 运行阶段,必选
                "Run"    : {"TimeLimit": 1000, "MemoryLimit": 16, "NProcLimit": 1},
                // 答案检查阶段,可选,默认值见下
                "Check"  : {"TimeLimit": 60000, "MemoryLimit": 128, "NProcLimit": 64}
            }
        },
        {
            // C++ 语言
            "Lang"   : "cpp",
            // 使用默认评测脚本,答案比对方式为 NCMP(testlib)Script 将被忽略
            "Judge"  : {"Type": "default", "Script": "", "Cmp": "NCMP"},
            // 运行时配置Run 必须存在,其余可选,默认值见 C 语言部分
            "Runtime": {
                "Run": {"TimeLimit": 1000, "MemoryLimit": 16, "NProcLimit": 1}
            }
        },
        {
            "Lang"   : "python3",
            "Judge"  : {"Type": "default", "Script": "", "Cmp": "NCMP"},
            "Runtime": {
                "Run": {"TimeLimit": 1000, "MemoryLimit": 16, "NProcLimit": 1}
            }
        },
        {
            "Lang"   : "pypy3",
            "Judge"  : {"Type": "default", "Script": "", "Cmp": "NCMP"},
            "Runtime": {
                // pypy3 运行时内存常数开销大A+B 问题内存至少给到 80 MB
                "Run": {"TimeLimit": 1000, "MemoryLimit": 80, "NProcLimit": 1}
            }
        },
        {
            "Lang"   : "rust",
            "Judge"  : {"Type": "default", "Script": "", "Cmp": "NCMP"},
            "Runtime": {
                "Run": {"TimeLimit": 1000, "MemoryLimit": 16, "NProcLimit": 1}
            }
        }
    ],
    // 题目构建阶段,用于生成测试数据等,可选,默认值见下
    "Prebuild" : {"TimeLimit": 300000, "MemoryLimit": 256, "NProcLimit": 64},
    // 评测点信息,总分应当为 100 分
    "Tasks"    : [
        // 第一个评测点,分值 10 分,使用 ./data/{input,output}/1.{input,output} 为测试数据
        {"Id": 1, "Points": 10},
        {"Id": 2, "Points": 20},
        {"Id": 3, "Points": 30},
        {"Id": 4, "Points": 40}
    ]
}

评测脚本

  1. 默认评测脚本目前只支持 c 语言和 cpp,参见 ../../framework/template/default/{c,cpp}.Makefile
  2. 自定义评测脚本参见 ./judge/custom.Makefile
  3. prebuild.Makefile: 题目初始化脚本,用于编译辅助程序、生成数据等。如果存在该文件,系统会在题目分发到判机后自动执行,否则跳过该步骤

注意事项

  1. 打包的时候确保 config.json, data, judge 在根目录下