标题
增加 1 行删除 1 行
1个人团队文件保存内容登记1【考前复习】个人团队文件保存内容登记
正文
增加 169 行删除 5 行
1234567891011121314151617181920157 行未改动全部展开178179180181182183184描述内容自团队:[https://www.luogu.com.cn/team/103072#main](https://www.luogu.com.cn/team/103072#main)>$该团队仅用于个人算法模板保存与共享$# **内容登记:**## **最小生成树模板:**### **课程内容**https://xinyoudui.com/courses/1708/all/#/pages/63733 \https://vjudge.net/contest/768814 \https://vjudge.net/contest/769118### **官方3份**:Kruskal构造树,Kruskal,prim;### **个人2份**:Kruskal,prim;## **字符串哈希**:### 课程内容概览https://vjudge.net/contest/770555#rank \https://xinyoudui.com/courses/1708/all/#/pages/60219 \https://vjudge.net/contest/770558#overview157 行未改动全部展开```### **官方2组:**- 字符串哈希-秦九韶算法:团队文件;- 哈希讲义1组(3份)### 官方电子1份- 双哈希:[https://pastecode.dev/s/a32fl5hy](https://pastecode.dev/s/a32fl5hy)1234567891011121314151617181920212223242526157 行未改动全部展开184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348描述内容自团队:[https://www.luogu.com.cn/team/103072#main](https://www.luogu.com.cn/team/103072#main)luogu.me记得手动更新\专栏双站快速跳转:[专栏](https://www.luogu.com.cn/article/0hpegxdh)/[luogu.me专栏](https://www.luogu.me/article/0hpegxdh)>$该文章仅用于个人算法模板保存内容和快速检索与资源共享$>$该团队仅用于个人算法模板保存与共享$# **内容登记:**## **!最小生成树模板:**### **课程内容**https://xinyoudui.com/courses/1708/all/#/pages/63733 \https://vjudge.net/contest/768814 \https://vjudge.net/contest/769118### **官方3份**:Kruskal构造树,Kruskal,prim;### **个人2份**:- Kruskal,prim;# **!字符串哈希**:### 课程内容概览https://vjudge.net/contest/770555#rank \https://xinyoudui.com/courses/1708/all/#/pages/60219 \https://vjudge.net/contest/770558#overview157 行未改动全部展开```### **官方2组:**- 字符串哈希-秦九韶算法:团队文件;- 哈希讲义1组(2份)### 官方电子1份- 双哈希:[https://pastecode.dev/s/a32fl5hy](https://pastecode.dev/s/a32fl5hy)## **!字典树**### 课程内容:- https://vjudge.net/contest/772615- 更多见团队内讲义&PPT### 官方2组- 字典树讲义- 字典树PPT\代码模板见 **PPT** 或 **讲义** 或 **偷来的别人模板(陶羽轩's)**###### 官方电子0份- ?###### 个人0份- ?### 个人电子?份- [P8306](https://www.luogu.com.cn/record/252320328)别问我为什么代码和有些人一样。。。## **!计数dp**### 课程内容:- https://www.luogu.com.cn/training/919293#problems- https://vjudge.net/contest/774596#problem\## **!树状数组**### 课程内容:- https://xinyoudui.com/courses/1708/all/#/pages/62123- https://vjudge.net/contest/779975### 官方1组- PPT### 个人1份- 树状数组模板(团队文件)### 个人电子?份- 见提交记录## **!模板:Title**### 课程内容:- xinyoudui.com/?- vjudge.net/?### 官方2组- ?### 官方电子?份- ?### 个人?份- ?### 个人电子?份- ?# ----------春季内容-----------## ★【考试技巧重点】STL与常数优化(考前可复习)### 快读快写- 好吧,其实约等于快读慢写```cpp//P10815 差一点AC代码#include<bits/stdc++.h>using namespace std;int n;long long sum;inline void read(int &x){bool neg=0;x=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')neg=true;ch=getchar();}while(ch>='0'&&ch<='9'){if(neg)x=x*10+('0'-ch);else x=x*10+(ch-'0');;ch=getchar();}}inline void write(int x){bool neg = false;if (x < 0) {neg = true;putchar('-');}static int sta[40];int top = 0;do {sta[top++] = x % 10;x /= 10;} while (x);if (neg)while (top) putchar('0' - sta[--top]);elsewhile (top) putchar('0' + sta[--top]);}int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);read(n);for(int i=1;i<=n;i++){int x;read(x);// cout<<x<<'\n';sum+=x;}write(sum);}```- 小灶:在有些题getchar()过不了,可以用getchar_unlocked()如[P10815](https://www.luogu.com.cn/problem/P10815),但不建议,有的编译器不行- [P10815 AC代码](https://www.luogu.com.cn/record/268878441)(其实就是在上面代码的基础上 开头加了一个`#define getchar() getchar_unlocked()`)### 【考试技巧重点】★常见常数优化(卡常)- 关闭同步流```cppios::sync_with_stdio(0);cin.tie(0);cout.tie(0);//0可以用null false等替代```- ++i 代替 i++```cpp// for等使用++i会比i++快,原因不说了,约能快0.5X//例for(int i=1;i<=n;++i){read(n);}```- 使用用位运算代替四则运算\例:```cppx*10 => (x<<3)+(x<<2);x*8 => x<<3;x/2 => x>>1;```- emplace()\emplace()代替push\emplace_back()代替push_back() 可以加速## 内容未完待续,团队文件里放了STL和常数优化PPT、代码,这些技巧很重要,而且不难# 其它## 最长上升子序列- <https://www.luogu.com.cn/problem/B3637#ide>## 快速幂qpow- [P1226](https://www.luogu.com.cn/problem/P1226#ide)```cpp#include<iostream>using namespace std;long long a,b,p;long long qp(long long a,long long b){long long ans=1,t=a;while(b>0){if(b&1){ans*=t;ans%=p;}t*=t;t%=p;b>>=1;}return ans;}int main(){cin>>a>>b>>p;long long ans=qp(a,b);ans=ans%p;printf("%lld^%lld mod %lld=%lld",a,b,p,ans);return 0;}```