不针对题解
大部分基于链表的做法会被此 hack 卡到 500ms+(本地),优化不够则会 TLE,请求管理员添加。
生成器:
#include<bits/stdc++.h>
using namespace std;
int n = 200000 , cnt;
int main()
{
freopen("data.in" , "w" , stdout);
srand(time(0));
cout << n << '\n';
while(cnt <= n)
{
while(rand() % 330 != 0)
{
cnt++;
if(cnt > n)
{
break;
}
cout << "1 ";
}
while(rand() % 8 != 0)
{
cnt++;
if(cnt > n)
{
break;
}
cout << "0 ";
}
}
return 0;
}