[OI向?] ubuntu下一些常用的技巧

想起来什么就写什么吧。

Ubuntu下的对拍程序

python是最为简便的。

from os import system
while True:
    system("./make > in")
    system("./std < in > b")
    system("./my < in > s")
    if(system("diff -bB s b")):
        print("MMP")
        exit(0)
    print("pass")

另存为pai.py

make是你的生成数据程序
std是你的暴力正解,my是你的对拍正解。

整个过程大概是运行make,输出重定向至文件in
然后输入重定向,运行std和my,分别输出重定向至sb
然后用diff进行比对,如果出错则停止。

终端中运行:
python pai.py

Ubuntu下.sh无法运行

sudo chmod 755 my.sh

可视化比对(diff)工具

安装:
sudo apt install meld

运行(在终端输入):
meld

你也可以按右上方的dash来进行查找。

据说能加快应用启动速度的东西(16.04):

sudo apt install preload
装好就可以不用管了的样子....

posted @ 2018-04-30 15:03  NagaseIori  阅读(255)  评论(0编辑  收藏  举报