待完善。

编号

题目命名规则:

  • A:模板题
  • U:随手出的
  • P:试机题以及比赛原题
  • G:季赛题目

季赛数字:前两位为年份后两位(如2021年就为21),第三位为当年第几场比赛,最后一位为题目编号(1-9)

题目规范

题面等规范请见 OI-Wiki https://oi-wiki.net/contest/problemsetting/

详情请见 主题库题目规范

这里尤其说明一下 config.yaml 文件格式及用法。详情请见 Hydro 官方文档

修改题目时间,空间限制,以及设置特殊题型(如提交答案,交互,SPJ),设置子任务 Subtask 都需要通过 config.yaml 文件进行控制。config.yaml 可以在题目文件页左侧“测试数据”栏点击 Create File 进行创建,模板如下:

# 题目类型,可以为 default(比对输出,含spj), submit_answer(提交答案), interactive(交互题)
type: default

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

# 输入输出文件名(例:使用 foo.in 和 foo.out),若使用标准 IO 删除此配置项即可,一般无需配置。若配置请务必在题目中说明使用文件 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 设置项!
score: 50     # 单个测试点分数
time: 1s      # 时间限制
memory: 256m  # 内存限制
cases:
  - input: abc.in
    output: def.out
  - input: ghi.in
    output: jkl.out
# 或使用Subtask项:
subtasks:
  - score: 30
    time: 1s
    memory: 64m
    cases:
      - 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 内的语言代码相同)
langs:
  - c
  - cc
  - pas

下面是一个例子,即 P1002 APIO 的 config.yaml:

time: 1000ms
memory: 1024m
user_extra_files:
  - roads.h
subtasks:
  - score: 5
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: MediumStar-01.in
        output: MediumStar-01.out
      #省略了部分
  - score: 7
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: Line-01.in
        output: Line-01.out
      - input: Line-02.in
        output: Line-02.out
      - input: Line-03.in
        output: Line-03.out
      - input: Line-04.in
        output: Line-04.out
      - input: MediumLine-01.in
        output: MediumLine-01.out
      - input: MediumLine-02.in
        output: MediumLine-02.out
      - input: MediumLine-03.in
        output: MediumLine-03.out
      - input: SmallLine-01.in
        output: SmallLine-01.out
      - input: SmallLine-02.in
        output: SmallLine-02.out
      - input: SmallLine-03.in
        output: SmallLine-03.out
      - input: SmallWeightLine-01.in
        output: SmallWeightLine-01.out
      - input: SmallWeightLine-02.in
        output: SmallWeightLine-02.out
      - input: UnweightedCorners-01.in
        output: UnweightedCorners-01.out
      - input: UnweightedLine-01.in
        output: UnweightedLine-01.out
      - input: UnweightedLine-02.in
        output: UnweightedLine-02.out
  - score: 14
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: Samples-01.in
        output: Samples-01.out
      - input: Samples-02.in
        output: Samples-02.out
      - input: Small-01.in
        output: Small-01.out
      - input: Small-02.in
        output: Small-02.out
      #省略了部分
  - score: 10
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: Medium-01.in
        output: Medium-01.out
      #省略了部分
  - score: 17
    type: min
    cases:
      - input: Unweighted-01.in
        output: Unweighted-01.out
      - input: Unweighted-02.in
        output: Unweighted-02.out
      #省略了部分
  - score: 25
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: Samples-01.in
        output: Samples-01.out
      #省略了部分
  - score: 22
    type: min
    cases:
      - input: Corners-01.in
        output: Corners-01.out
      - input: Full-01.in
        output: Full-01.out
      #省略了部分

这里给出 config.yaml 的生成器,当且仅当使用 subtasks 取最小值时使用。

  freopen("config.yaml", "w", stdout);
	int tim = 1000, mem = 128;//时间,空间,可修改
	printf("time: %dms\nmemory: %dm\ntype: default\n", tim, mem);
	int n = 2;// subtask 数量,可修改
	printf("subtasks: \n");
	while(n --) {
		int score ; scanf("%d", &score);// 输入subtask的分值
		printf("  - score: %d\n    type: min\n    cases:\n", score);
		int l, r;
		scanf("%d%d", &l, &r);// 输入subtask对应的文件编号[l, r]
		for(int i = l; i <= r; i ++) 
			printf("      - input: data%d.in\n        output: data%d.out\n", i, i);
	}

1 条评论

  • 1