数据结构
文章平均质量分 93
1
zzqwtc
blog dot zzqwtc dot com
展开
-
基础莫队算法
基础莫队 将待查询区间排序 排序: 先按左端点分块的编号递增排序 块内按照右端点的下标递增排序 HH的项链 题意 HH 有一串由各种漂亮的贝壳组成的项链。 HH 相信不同的贝壳会带来好运,所以每次散步完后,他都会随意取出一段贝壳,思考它们所表达的含义。 HH 不断地收集新的贝壳,因此他的项链变得越来越长。 有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同的贝壳? 这个问题很难回答,因为项链实在是太长了。 于是,他只好求助睿智的你,来解决这个问题。 思路 莫队模板题 数据范围 1≤N≤50原创 2021-10-01 20:37:51 · 3303 阅读 · 0 评论 -
Trie(字典树)
AcWing 835. Trie字符串统计 #include<iostream> using namespace std; typedef long long ll; typedef pair<int, int> PII; const int N = 1e5 + 10; int son[N][26],cnt[N],idx; char str[N]; void insert(char str[]){ int p =0; for(int i = 0;str[i];原创 2020-07-13 23:37:57 · 1728 阅读 · 0 评论 -
邻接表
邻接表的数组实现 #include<bits/stdc++.h> #define INF 0x3f3f3f3f3f3f3f3f #define mod 1000000007 #define IOS ios::sync_with_stdio(false) #define endl '\n' using namespace std; typedef long long ll; const ...原创 2020-03-12 15:35:45 · 1683 阅读 · 0 评论 -
二叉搜索树
#include<bits/stdc++.h> #define INF 0x3f3f3f3f3f3f3f3f #define mod 1000000007 #define IOS ios::sync_with_stdio(false) #define endl '\n' using namespace std; typedef long long ll; const int maxn ...原创 2020-03-11 15:55:24 · 1663 阅读 · 0 评论 -
二叉树的建立和遍历
#include<bits/stdc++.h> #define INF 0x3f3f3f3f3f3f3f3f #define mod 1000000007 #define IOS ios::sync_with_stdio(false) #define endl '\n' using namespace std; typedef long long ll; const int maxn...原创 2020-03-11 15:13:50 · 1698 阅读 · 0 评论