随笔分类 -  数据结构

摘要:#include <iostream>#include <algorithm>#include <stdio.h>#include <string>#include <string.h>#include <stdlib.h>#include <math.h>#include <vector>#include <map>#include <queue>#include <stack>#include <set>using namespace std ;c 阅读全文
posted @ 2013-05-10 13:30 Roly Yu 阅读(187) 评论(0) 推荐(0)
摘要:#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <fstream>#include <vector>#include <map>#include <queue>#include <stack>#include <math.h>#include <stdlib. 阅读全文
posted @ 2013-05-07 21:47 Roly Yu 阅读(207) 评论(0) 推荐(0)
摘要:这道题拿过来感觉很蒙 , 因为以前做的都是点更新询问区间 , 或是区间更新询问点 , 这道题是在[a,b]区间内隔k个数更新一次((i - a) % k == 0即i%k==a%k),对于树状数组来说按照一维的方式定义, 后面在加上两维 c[i][k][i%k] (a<=i<=b), 相当于在一维c[i]每个节点加入了一些信息,来记录每次更新,询问时候再加上原数组即可得到结果。#include <iostream>#include <stdio.h>#include <string>#include <string.h>#includ 阅读全文
posted @ 2013-05-03 21:18 Roly Yu 阅读(186) 评论(0) 推荐(0)
摘要:二分+树状数组动态的寻找比a大k的数#include <stdio.h>#include <iostream>#include <string>#include <string.h>#include <algorithm>#include <stdlib.h>#include <math.h>#include <vector>#include <map>using namespace std;const int maxn = 100005;int c[maxn];int lowbit(i 阅读全文
posted @ 2013-05-02 13:20 Roly Yu 阅读(197) 评论(0) 推荐(0)
摘要:/* s1[i]与s2[i]匹配,树状数组i位置更新1,否则更新0。*/#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>using namespace std;const int maxn = 1000005;int c[maxn];char s1[maxn],s2[maxn];int min(int a,int b){ return a>b?b:a;}int lowbit(int x){ return x&(-x);}void upda 阅读全文
posted @ 2013-04-29 12:31 Roly Yu 阅读(174) 评论(0) 推荐(0)