Skip to content

Instantly share code, notes, and snippets.

@albertoxamin
Created April 2, 2019 09:10
Show Gist options
  • Save albertoxamin/37a37675859aecbb69b2f1dec518204c to your computer and use it in GitHub Desktop.
Save albertoxamin/37a37675859aecbb69b2f1dec518204c to your computer and use it in GitHub Desktop.
#!/bin/bash
# Judge script
# For personal use only, not to be used on a real judge system
# Execution: put the executable in the same folder with the inputs as .in files and expected outputs as .ans
for input in *.in; do
for ((i=0; i<=3; i++)); do
./a.out < "$input" > "temp"
filename=$(basename ${input%.*}.ans)
result=$(diff -w "$filename" "temp")
if [ $? -eq 0 ]
then
echo "OK"
else
echo "diff" $result $filename
fi
rm "temp"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment