请求撤下@Diu 的题解link
https://www.luogu.com.cn/blog/diu/solution-p1269
其复杂度为 O(2deep),deep 为树高度。
使用
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<19001<<endl;
cout<<"2 2 41 3 41"<<endl;
for(int i=2;i<=19001;i++){
if(i&1){
cout<<"1 "<<max(1,i-3)<<" 41"<<endl;
}
else if(i!=19000){
cout<<"3 "<<max(1,i-2)<<" 41 "<<i+2<<" 41 "<<i+3<<" 41"<<endl;
}
else cout<<"1 18998 41"<<endl;
}
cout<<114514<<endl;
return 0;
}
在其他题解通过情况下,生成数据可以卡掉该题解使其tle。