对拍
有些时候我们没有很强的样例,或者样例太大无法调试,亦或不确定自己代码的正确性。此时我们可以通过对拍来找到合适的 hack
数据。
提供一组 bash
对拍脚本:
for n in {1..100000..1}
do
echo -e "$n \c"
./g > test.in
./b < test.in > test.ans
if ! timeout 1s ./a < test.in > test.out; then
echo "TLE"
exit 1
fi
if ! diff test.out test.ans -Bb; then
echo "WA"
exit 1
fi
echo "AC"
done
注意:切忌从要对拍的代码 a.cpp
中截取代码放入 baoli.cpp
中!