Skip to main content

测试数据格式


测试数据格式

自动模式

Tips

您可以直接选择文件(支持多选)上传或将文件拖拽至相应位置上传。
若上传文件为 zip 格式,将会自动进行解压操作。

对于一般的题目,您只需提供 .in.out/.ans 文件,以下是一个例子。
请务必确保文件名中含有数字。形如 sample.in 的文件是不会被自动识别的。

喵? tree
.
├── a1.in
├── a1.out
├── a2.in
├── a2.out
├── a3.in
└── a3.out

测试数据将被自动识别,并使用 1S 256MB 的限制。

使用配置文件

Tips

推荐您通过 评测设置 在线编辑题目配置,可以拥有更好的编辑体验。

上传 config.yaml 文件即可,文件格式如下(下方所有样例均为可选项,若无说明则预填写的内容即为默认值):

# 题目类型,可以为 default(比对输出,可以含spj), objective(客观题), interactive(交互题)
type: default

# 全局时空限制(此处的限制优先级低于测试点的限制)
time: 1s
memory: 128m

# 输入输出文件名(例:使用 foo.in 和 foo.out),若使用标准 IO 删除此配置项即可
filename: foo

# 此部分设置当题目类型为 default 时生效
# 比较器类型,支持的值有 default(直接比对,忽略行末空格和文件末换行), ccr, cena, hustoj, lemon, qduoj, syzoj, testlib(比较常用)
checker_type: default
# 比较器文件(当比较器类型不为 default 时填写)
# 文件路径(位于压缩包中的路径)
# 将通过扩展名识别语言,与编译命令处一致。在默认配置下,C++ 扩展名应为 .cc 而非 .cpp
checker: chk.cc

# 此部分设置当题目类型为interactive时生效
# 交互器路径(位于压缩包中的路径)
interactor: interactor.cc

# Extra files 额外文件
# These files will be copied to the working directory 这些文件将被复制到工作目录。
# 提示:您无需手动上传 testlib.h。
user_extra_files:
  - extra_input.txt
judge_extra_files:
  - extra_file.txt

# Test Cases 测试数据列表
# If neither CASES or SUBTASKS are set(or config.yaml doesn't exist), judge will try to locate them automaticly.
# 如果 CASES 和 SUBTASKS 都没有设置或 config.yaml 不存在, 系统会自动尝试识别数据点。
# We support these names for auto mode: 自动识别支持以下命名方式:
# 1. [name(optional)][number].(in/out/ans)         RegExp: /^([a-zA-Z]*)([0-9]+).in$/
#   examples: 
#     - c1.in / c1.out
#     - 1.in / 1.out
#     - c1.in / c1.ans
# 2. input[number].txt / output[number].txt        RegExp: /^(input)([0-9]+).txt$/
#   - example: input1.txt / input2.txt
#
# The CASES option has higher priority than the SUBTASKS option!
# 在有 CASES 设置项时,不会读取 SUBTASKS 设置项!
#
# The CASES option has been deprecated in the new version, please use the more personalized SUBTASKS!
# CASES 已于新版本中被废弃,请使用个性化程度更高的SUBTASKS!
# score: 50     # 单个测试点分数
# time: 1s      # 时间限制
# memory: 256m  # 内存限制
# cases:
#   - input: abc.in
#     output: def.out
#   - input: ghi.in
#     output: jkl.out
# 或使用Subtask项:
subtasks:
  - score: 30
    type: min # 可选 min/max/sum,分别表示取所有测试点最小值、所有测试点最大值、所有测试点之和
    time: 1s
    memory: 64m
    cases:
      - time: 0.5s
        memory: 32m # 可对单个测试点单独设置时间限制和内存限制
        input: a.in
        output: a.out
      - input: b.in
        output: b.out
  - score: 70
    time: 0.5s
    memory: 32m
    if: [0] # 可选,传入数组,表示仅在subtask0通过时此subtask才计分
    cases:
      - input: c.in
        output: c.out
      - input: d.in
        output: d.out

# 提交语言限制
# 列举出所有本题允许使用的语言对应的代码(需要和评测机 lang.yaml 内的语言代码相同)
# 使用语言ID而非名称!对于有子类的选项,请详细至子分类!
langs:
  - c
  - cc
  - cc.cc11o2
  - pas

# 时间内存倍率
# 对某语言设置时间或内存倍率(需要和评测机 lang.yaml 内的语言代码相同)
# 部分语言默认已存在倍率,请前往控制面板中查看!
# 使用语言ID而非名称!对于有子类的选项,请详细至子分类!
time_limit_rate:
  py.py3: 2
memory_limit_rate:
  java: 1.5

可以在 此题库open in new window 中找到各种类型题目的配置示例。