woj-server/resource/runner/problem/example/README.md

2.1 KiB

示例题目

文件构成

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

详细说明

题目配置信息

{
  "Runtime": {
    // 运行时配置
        "TimeLimit": 1000, // 时间限制 (ms)
        "MemoryLimit": 16, // 内存限制 (MB)
        "NProcLimit": 1    // 进(线)程 限制
    },
  "Languages": [
    // 支持的语言
        // c 语言,使用自定义评测脚本,脚本为 ./judge/XYZ.Makefile
        {"Lang": "c", "Type": "custom", "Script": "XYZ.Makefile", "Cmp": ""},
        // c++ 语言,使用默认评测脚本,答案比对方式为 NCMP(testlib)
        {"Lang": "cpp", "Type": "default", "Script": "", "Cmp": "NCMP"}
  ],
  "Tasks": [
    // 评测点信息
        {"Id": 1, "Points": 10}, // 第一个评测点,分值 25 分,使用 ./data/{input,output}/1.{input,output} 为测试数据
        {"Id": 2, "Points": 20},
        {"Id": 3, "Points": 30},
        {"Id": 4, "Points": 40}
    ]
}

评测脚本

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

注意事项

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