从一开始的 NOI Linux 生活(基础篇)
MatrixGroup · · 个人记录
- Copy Paste instead of Ctrl-CV
- VSCode terminal:
Ctrl+~ - VSCode 界面放大: Ctrl + =
- VSCode 界面缩小: Ctrl + -
编译:
g++ a.cpp -o a -O2 -std=c++14 -Wall -Wextra -Wconversion -Wshadow
运行:
./a
- Linux 不存在扩展名,只是给你看的。
测试添加:(-D_GLIBCXX_DEBUG -fsanitize=undefined -fsanitize=address)
无限栈(全局)
-ulimit -s unlimited
常用指令:
ls
ll
rm FILE
cd ..
cd DIRECTORY
pwd
python3
mkdir
time COMMAND
timeout TIME_LIMIT COMMAND
size FILE
usr/bin/time/ -v ./FILE
对拍:
clock_t a,b,mx;
int main()
{
//system("g++ a.cpp -o a -O2");
//system("g++ b.cpp -o b -O2");
//system("g++ gen.cpp -o gen -O2");
int tc=0;
while(true)
{
++tc;
cerr << "test case "<<tc<<": ";
system("./gen PARAMETER > in");
system("./b < in > ans");
a=clock();
if(system("./a < in > out"))
{/*RE*/}
b=clock();
if(system("diff out ans > judge"))
{/*WA*/}
mx=max(mx,b-a);
if(mx>TIMELIMIT)
{/*TLE*/}
/*AC*/
}
}
- 哪个是评测的时间?user time。