Files
2026-09-09 09:28:29 +08:00

64 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CCF / NOI → HydroOJ 数据归档
来源:<https://noi.ccf.org.cn/zxzy/lnzl/>(页码 13)。
## 已收集内容
- 28 条官方“题目及数据”资料页面(2009–2026,按官网当前列表)
- 94 个官方资源文件:64 个 ZIP、13 个 RAR、17 个 PDF 题面
- 每个资源的来源 URL、原始文件路径、字节数与 SHA-256 均在 `dist/manifest.json` 中记录
- 资源下载需要官方资料页作为 Referer;脚本已处理此要求。
## Hydro Problem Format ZIP
可提交/导入的归档位于:
```text
dist/hydro-zips/<exam-id>/<problem-id>.zip
```
每个 ZIP 符合 [Hydro Problem Format](https://hydro.js.org/zh/docs/Hydro/user/problem-format):根目录含 `problem.yaml``problem_zh.md``testdata/config.yaml`,并将官方 `.ans` 输出转换为 Hydro 使用的 `.out`。当前已生成 71 个题目 ZIP。
Hydro 后台可直接用“导入题目”导入每个 ZIP。
## 原始中间文件(不提交)
源资源和解压目录仅用于生成:
```text
dist/raw/
dist/hydrooj/
```
它们被 `.gitignore` 排除。
## 继续转换
完整转换(会解压全部 ZIP 与 RAR,临时与输出空间需求较高):
```bash
python tools/build_hydrooj.py --output dist
```
生成 Hydro 格式 ZIP(并将对应的官方 PDF 放入 `additional_file/`,在 `problem_zh.md` 中以 `file://文件名` 引用):
```bash
python tools/create_hydro_zips.py --input dist/hydrooj --output dist/hydro-zips
```
仅重新下载/补齐官方资源及清单(不解压):
```bash
python tools/build_hydrooj.py --output dist --download-only
```
两种命令都可重复运行;已存在的 `dist/raw/` 文件不会重复下载。
## 验证
```bash
python -m unittest tests/test_build_hydrooj.py -v
```
> 官方资料页带有署名/非商业授权说明。导入或公开题面、数据前,应确认你的 HydroOJ 使用方式符合 CCF/NOI 的授权条件。