Skip to content

Instantly share code, notes, and snippets.

@frankli0324
Created April 17, 2020 10:45
Show Gist options
  • Save frankli0324/7efcbc24d4e8fcee379794ecde52cf86 to your computer and use it in GitHub Desktop.
Save frankli0324/7efcbc24d4e8fcee379794ecde52cf86 to your computer and use it in GitHub Desktop.
ACM Challenges
#!/bin/bash
if [[ -z $1 ]];then
echo $0 题目目录
exit
fi
if [ ! -d $1 ];then
echo 目录 $1 不存在
exit
fi
g++ $1/std.* -o $1/a.out --std=c++11 -O2
for i in `ls $1/data/*.in`;do
echo test: $i
cat $i| /usr/bin/time -l $1/a.out 2>&1 > $1/data/user.out
if ! diff -w `echo $i | sed -E 's/(.*).in/\1.out/g'` $1/data/user.out;then
echo "wrong answer on case $i"
exit 1
fi
done
rm -f $1/data/user.out
rm -f $1/a.out
echo 'Accepted'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment