如题,ubantu系统用sh写了一个线段树的对拍,一直是ac,但对着对着总是突然卡一下,然后突然提示系统崩溃了要注销重启。大佬们有遇到这种情况吗?有啥解决办法吗?
数据生成器的数据范围远小于需要的大小,自己的程序在洛谷上也ac了(P3372)
下面是自己的对拍程序(.sh)
while true; do
./data>data.in
./std<data.in>std.out
./mine<data.in>mine.out
if diff std.out mine.out;then
printf "AC\n"
else
printf "WA\n"
exit 0
fi
done
下面是我的数据生成器
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define maxn 9999
int main()
{
srand(time(NULL));
ll n=1+rand()%maxn;
ll m=1+rand()%maxn;
cout<<n<<" "<<m<<endl;
for(int i=1;i<=n;i++)
{
printf("%d ",1+rand()%maxn);
}
cout<<endl;
for(int i=1;i<=m;i++)
{
ll k=rand()%2;
if(k==0)
{
ll l=1+rand()%n;
ll r=1+rand()%n;
if(l>r)swap(l,r);
cout<<2<<" "<<l<<" "<<r<<endl;
}
else
{
ll l=rand()%n+1;
ll r=rand()%n+1;
if(l>r)swap(l,r);
cout<<1<<" "<<l<<" "<<r<<" "<<rand()%n+1<<endl;
}
}
return 0;
}