正文
增加 85 行删除 7 行
4 行未改动56789101112131415161718192021222324252627283 行未改动32333435363738394041424344454647484946 行未改动969798991001011021031,324 行未改动全部展开4 行未改动~~非全部原创(可能也没有原创)~~~~别问为什么zsyun_Cg这么懒~~目前28模板,持续更新中,可借走模板,但不许说是自己的## 模板集::::success[代码框架]```cpp#include<bits/stdc++.h>#define ll long longusing namespace std;const int N=1e5+10,M=1e3+10;int main(){//freopen(".in","r",stdin);//freopen(".out","w",stdout);//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);return 0;}```3 行未改动```cpp#include<bits/stdc++.h>#define ll long long#define endl cout<<"\n";using namespace std;const int N=1e5+10,M=1e3+10;const int MOD_1=998244353,MOD_2=1000000000+7,MOD_3=1000000000+9;const int INV2_1=499122177,INV2_2=500000004,INV2_3=500000005;int main(){//freopen(".in","r",stdin);//freopen(".out","w",stdout);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);return 0;}```46 行未改动:::::::::::success[背包DP]:::success[01背包]1,324 行未改动全部展开4 行未改动56789101112131415161718192021222324252627283 行未改动32333435363738394041424344454647484950515253545556575859606162636446 行未改动1111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811,324 行未改动全部展开4 行未改动~~非全部原创(可能也没有原创)~~~~别问为什么zsyun_Cg这么懒~~目前29模板,持续更新中,可借走模板,但不许说是自己的## 模板集::::success[代码框架]```cpp#include<bits/stdc++.h>#define ll long longusing namespace std;const int N=1e6+10,M=1e3+10;int main(){//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);//freopen(".in","r",stdin);//freopen(".out","w",stdout);return 0;}```3 行未改动```cpp#include<bits/stdc++.h>#define ll long long#define endl '\n'using namespace std;const int N=1e6+10,M=1e3+10;const int MOD_1=998244353,MOD_2=1000000000+7,MOD_3=1000000000+9;const int INV2_1=499122177,INV2_2=500000004,INV2_3=500000005;bool ctrl_debug(int fin){static bool f=1;if(fin==3) return f;else f=bool(fin);return 1;}//控制debug,1为输出,0为不输出template<typename T>void debug(T a){if(ctrl_debug(3)){cout<<"debug: "<<a<<'\n';//↓本地不报错,评测机报错//system("pause");}return;}int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);//freopen(".in","r",stdin);//freopen(".out","w",stdout);ctrl_debug(1);return 0;}```46 行未改动:::::::::::success[对拍]:::success[随机数生成器]```cpp#include<bits/stdc++.h>#define ll long longusing namespace std;const int N=1e6+10,M=1e3+10;int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);//freopen(".in","r",stdin);//freopen(".out","w",stdout);srand(time(0));cout<<rand()%100<<" "<<rand()%100<<"\n";//输出两个100以内的随机数return 0;}```* 先在前面调用`srand(time(0));`* 然后用`rand()%n`生成随机数,n-1为最大值::::::success[对拍器]```cpp#include<bits/stdc++.h>#define ll long longusing namespace std;const int N=1e6+10,M=1e3+10;int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);//freopen(".in","r",stdin);//freopen(".out","w",stdout);ll t=0;while(1){cout<<"test: "<<t++<<"\n";system("随机数生成器.exe > data.in");system("暴力代码.exe < data.in > std.out");system("待测代码.exe < data.in > ab.out");if(system("fc std.out ab.out > diff.log")){cout<<"WA\n";break;}cout<<"AC\n";}return 0;}```* 代码中所有 `.exe`均为`.cpp`文件编译产生的可执行文件* 四个`.cpp`须在同一目录下* 运行对拍器会生成4个文件,两`.out`文件为两个程序的输出,`.in`为本组随机样例,`diff`文件为两个`.out`的集合:::[例示](https://www.luogu.com.cn/problem/U746695)::::::::success[背包DP]:::success[01背包]1,324 行未改动全部展开