标签: 模版

3 篇文章

并查集
模版 #include<bits/stdc++.h> using namespace std; int n,m,k,x,y; int pre[200005]; int find(int x) //查找根 { if (x!=pre[x]) pre[x]=find(pre[x]); return pre …
字典树Trie Tree
模版 struct trie { int next[26]; //指向子节点节点的下标,默认值为0则表示没有子节点,并用0-25代表'a'-'z' int isEnd; //是否为一个单词的结尾 }tree[500005]; int inc; //最后一个分配的字典树下标,用于分配新的节点下标 int insert(string s…
单调栈
模版 //以下所有将b[i]=q.top().second改为b[i]=q.top().first 即可得到元素的值而不是坐标。 //n为数组规模,默认下标从1开始 //数组a为原数组 //数组b为查找到的坐标(元素值) void findRMin(int n,int a[],int b[]) //寻找右边第一个比自…