如何正确配置测试数据/如何正确提交答案【keyword:数据点,测试点,子任务,捆绑测试】
基础版教程
第一部分 手动配置测试点
典 型 错 误 示 范。
首先,创建一个 txt 文件,然后将其更名为 1.in(实际上, 1.in.txt,cff.in.1 等名称都是可以的,在这里统一用 xxx.in 的格式了)。
接着,在这个文件里面存储你第一个测试点的输入。
再创建一个 txt 文件,命名为 1.out。在这个文件里面存储你第一个测试点的输出,剩下的命名以此类推。config.yml 不是必须的,我从来没写过这玩意。
创建一个 zip 压缩文件,然后将这些 in/out 文件压缩进去(拖进去)。不需要有任何多余的东西,zip 文件里面不需要有文件夹,直接将这些输入输出文件压缩进去。
错误的压缩方式:
xxx.zip
|
---xxx(Folder/文件夹)
|
---xxx.in,xxx.out
正确的压缩方式:
xxx.zip
|
---xxx.in,xxx.out
接下来,上传这个 zip 压缩文件就可以成功配置测试点了。
另注:创建一个 rar 压缩文件并将其后缀名改成 zip,并不会改变它是一个 rar 文件,必须重新创建一个 zip 文件!
上传成功后的这个界面可以更改测试点的时限空限分值等信息。
这样,测试点就配置成功了。
如何捆绑:
在第三栏填上子任务编号,在第四栏填上这个子任务的分值(每个测试点的分值都设成这个子任务的分值),最后下面勾选“最小分值最大时间”即可。
以这个图片为例:
我第七个 Subtask 的总分值想设成 33,所以我把所有在 Sub 7 的测试点都改成 33 分,并在下面选上最小分值最大时间。
第二部分 如何提交答案
使用提交答案提交,要先在提交页面中点击提交答案。
提交一个 zip 文件夹,里面只包含若干个 .out 文件,分别对应一个测试点的输出即可。
第三部分 随机生成测试点
首先,随机生成一定数量的输入数据。比如,可以用 CYaRon 生成数据。当然,生成普通一点的数据时,也可以直接用 rand 或者 mt19937。注意生成的数据要被存在 xxx.in。
接着,准备好这道题的 std。在程序主函数的开头加上两句 freopen:
freopen("xxx.in","r",stdin);
freopen("xxx.out","w",stdout);
接着按照这样的方式把所有的输入跑一遍就行了。
剩下的内容见第一部分。
进阶版教程
第一部分 Special Judge
当一个题目可以接受多种正确答案,即有多组解的时候,题目就必须被 Special Judge。Special Judge 程序使用输入数据和一些其他信息来判答你程序的输出,并将判答结果返回。
详见 Special Judge 使用说明。
还有疑问的可以参照 testlib.h 的说明。
第二部分 交互库
我手写过交互库,在主题库里面也有一道交互题,似乎搞懂了,但是又好像没太搞懂。详见交互题功能说明.
第三部分 题目测试点配置文件
这个东西其实不是配置测试点必要的,这个配置文件的命名很容易误导第一次出题的人。但是这篇文档也不难理解。实际上,我根本没有用过这玩意。
第四部分 自定义计分脚本
说到这个我就不困了。官方文档说的很清晰,我在最新的解密中也多次用到了这个“看起来很牛逼”的技术。比如,这是提交解密代码的题目的自定义计分脚本(upd:这里的 == WA 后来被改成了 != AC):
if (@status1 == WA and @status2 == AC); then
@status2 = WA; @score2 = 0;
fi
if (@status2 == WA and @status3 == AC); then
@status3 = WA; @score3 = 0;
fi
if (@status3 == WA and @status4 == AC); then
@status4 = WA; @score4 = 0;
fi
if (@status4 == WA and @status5 == AC); then
@status5 = WA; @score5 = 0;
fi
if (@status5 == WA and @status6 == AC); then
@status6 = WA; @score6 = 0;
fi
if (@status6 == WA and @status7 == AC); then
@status7 = WA; @score7 = 0;
fi
if (@status7 == WA and @status8 == AC); then
@status8 = WA; @score8 = 0;
fi
if (@status8 == WA and @status9 == AC); then
@status9 = WA; @score9 = 0;
fi
if (@status9 == WA and @status10 == AC); then
@status10 = WA; @score10 = 0;
fi
if (@status10 == WA and @status11 == AC); then
@status11 = WA; @score11 = 0;
fi
if (@status11 == WA and @status12 == AC); then
@status12 = WA; @score12 = 0;
fi
if (@status12 == WA and @status13 == AC); then
@status13 = WA; @score13 = 0;
fi
if (@status13 == WA and @status14 == AC); then
@status14 = WA; @score14 = 0;
fi
if (@status14 == WA and @status15 == AC); then
@status15 = WA; @score15 = 0;
fi
if (@status15 == WA and @status16 == AC); then
@status16 = WA; @score16 = 0;
fi
if (@status16 == WA and @status17 == AC); then
@status17 = WA; @score17 = 0;
fi
if (@status17 == WA and @status18 == AC); then
@status18 = WA; @score18 = 0;
fi
if (@status18 == WA and @status19 == AC); then
@status19 = WA; @score19 = 0;
fi
if (@status19 == WA and @status20 == AC); then
@status20 = WA; @score20 = 0;
fi
if (@status20 == WA and @status21 == AC); then
@status21 = WA; @score21 = 0;
fi
if (@status21 == WA and @status22 == AC); then
@status22 = WA; @score22 = 0;
fi
if (@status22 == WA and @status23 == AC); then
@status23 = WA; @score23 = 0;
fi
if (@status23 == WA and @status24 == AC); then
@status24 = WA; @score24 = 0;
fi
if (@status24 == WA and @status25 == AC); then
@status25 = WA; @score25 = 0;
fi
if (@status25 == WA and @status26 == AC); then
@status26 = WA; @score26 = 0;
fi
if (@status26 == WA and @status27 == AC); then
@status27 = WA; @score27 = 0;
fi
if (@status27 == WA and @status28 == AC); then
@status28 = WA; @score28 = 0;
fi
if (@status28 == WA and @status29 == AC); then
@status29 = WA; @score29 = 0;
fi
if (@status29 == WA and @status30 == AC); then
@status30 = WA; @score30 = 0;
fi
@total_score = @score1 + @score2 + @score3 + @score4 + @score5 + @score6 + @score7 + @score8 + @score9 + @score10 + @score11 + @score12 + @score13 + @score14 + @score15 + @score16 + @score17 + @score18 + @score19 + @score20 + @score21 + @score22 + @score23 + @score24 + @score25 + @score26 + @score27 + @score28 + @score29 + @score30;
它的作用就是:假如前面一个测试点没过,后面一个测试点过了,就判定为跳关,并把后一个测试点的状态设为 WA,分值设为
还有一个自定义计分脚本有点长(这个求助帖说的就是这份代码),一共