加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
go.sh 2.68 KB
一键复制 编辑 原始数据 按行查看 历史
Weaverzhu 提交于 2019-10-23 16:15 . -fsanitize=address
#!/bin/sh
compile() {
# Usage: compile <source file> <obj pathname>
if [ -f $2 ]; then
a=`stat -c %Y $1`
b=`stat -c %Y $2`
if [ $a -gt $b ]; then
echo compiling...
g++ $1 -o $2 -std=c++11 -Wall -fsanitize=address
suc=$?
if [ $suc -eq 0 ]; then
echo compile completed
else
echo Verdict: CE
exit 0
fi
fi
else
echo compiling...
g++ $1 -o $2 -std=c++11 -Wall -fsanitize=address
suc=$?
if [ $suc -eq 0 ]; then
echo compile completed
else
echo Verdict: CE
exit 0
fi
fi
}
run() {
echo running $1
if [ $# -gt 2 ]; then
echo log: to files
time $1 < $2 > $3
elif [ $# -gt 1 ]; then
echo ===========OUTPUT===========
time $1 < $2
echo ============END=============
else
echo ===========OUTPUT===========
time $1
echo ============END=============
fi
}
echo ============================
echo .
echo . Weaver_zhu\'s ACM
echo . v1.0
echo . Powered by linux bash
echo .
echo
if [ $# -eq 0 ]; then
compile "./main.cpp" "./bin/main"
run "./bin/main" "./input/in.txt"
elif [ $1 = "gen" ]; then
echo $1
echo log: generating data input
compile "./judger/generator.cpp" "./bin/gen"
run "./bin/gen" "./input/in.txt" "./input/in.txt"
elif [ $1 = "bin" ]; then
g++ main.cpp -o bin/main -std=c++11 -Wall
elif [ $1 = "stdin" ]; then
compile "./main.cpp" "./bin/main"
run "./bin/main"
elif [ $1 = "judge" ]; then
compile "./judger/generator.cpp" "./bin/gen"
while true; do
run "./bin/gen" "./input/in.txt" "./input/in.txt"
compile "./main.cpp" "./bin/main"
run "./bin/main" "./input/in.txt" "./output/out"
compile "./judger/std.cpp" "./bin/std"
run "./bin/std" "./input/in.txt" "./output/std"
if diff "./output/out" "./output/std"; then
echo Verdict: AC
else
echo Verdict: WA
exit 0
fi
done
elif [ $1 = "newf" ]; then
run "./bin/starter" "./judger/starter.txt" "./main.cpp"
elif [ $1 = "compile" ]; then
compile "./main.cpp" "./bin/main"
elif [ $1 = "test" ]; then
compile "./main.cpp" "./bin/main"
run "./bin/main" "./input/in.txt" "./output/out"
compile "./judger/std.cpp" "./bin/std"
run "./bin/std" "./input/in.txt" "./output/std"
if diff "./output/out" "./output/std"; then
echo Verdict: AC
else
echo Verdict: WA
fi
elif [ $1 = "python" ]; then
python3 "./main.py" < "./input/in.txt"
else
echo log: wrong input
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化