随笔分类 - 数据结构
摘要:1 #include 2 using namespace std; 3 const int maxn = 1000 + 5; 4 int C[maxn], n; 5 6 int lowbit(int x) {return x & -x;} 7 8 int sum(int x) { 9 int ret = 0; 10 while(x) { 11 ...
阅读全文
摘要:1 #include 2 using namespace std; 3 #define M(a, b) memset(a, b, sizeof(a)); 4 const int maxn = 1000 + 10; 5 6 struct AhoCorasickAutomata { 7 int ch[maxn][26], val[maxn], last[maxn], f[ma...
阅读全文
摘要:模板1:点修改:支持查询,更新; 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 const int maxn = 1000 + 10; 5 int a[maxn], qL, qR, p, v;
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 4 typedef struct TrieNode{ 5 bool flag; 6 TrieNode *next[26]; 7 TrieNode(){ 8 flag = false; 9 memse
阅读全文
摘要:1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cmath> 5 #include<cstring> 6 #include<set> 7 #include<map> 8 #include<queue>
阅读全文
摘要:一道关于栈的问题: 题目链接如下:http://vjudge.net/problem/UVA-673; 根据模型很容易想到用栈实现,下面贴出代码: 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cma
阅读全文

浙公网安备 33010602011771号