随笔分类 -  数据结构

摘要: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 ... 阅读全文
posted @ 2017-03-06 10:47 Robin! 阅读(198) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2017-02-20 20:41 Robin! 阅读(505) 评论(0) 推荐(0)
摘要:模板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; 阅读全文
posted @ 2017-02-16 22:05 Robin! 阅读(140) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-01-12 22:04 Robin! 阅读(236) 评论(0) 推荐(0)
摘要:1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cmath> 5 #include<cstring> 6 #include<set> 7 #include<map> 8 #include<queue> 阅读全文
posted @ 2016-12-30 09:46 Robin! 阅读(236) 评论(0) 推荐(0)
摘要:一道关于栈的问题: 题目链接如下:http://vjudge.net/problem/UVA-673; 根据模型很容易想到用栈实现,下面贴出代码: 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cma 阅读全文
posted @ 2016-11-22 18:50 Robin! 阅读(115) 评论(0) 推荐(0)