- 博客(14)
- 收藏
- 关注
原创 【Codevs1228】苹果树(dfs序+树状数组)
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int maxn=100010;int n,m,a1,a2,in[maxn],out[maxn],head[maxn],ncnt,cnt,c[maxn],vis[maxn];struct edge
2016-05-30 11:57:52 452
原创 COJS.36求和问题
论树状数组与线段树的博(dui)弈(gang)动态的修改求和(zi)(cheng)万能的线段树(肯定不是我说的,但是和天勇勋押韵。。。)所以,题目来源:http://cojs.tk/cogs/problem/problem.php?pid=36 还有我的代码:#include<cstdio>#include<iostream>#include<algorithm>#include<cmath
2016-05-04 17:59:16 358
转载 [离散化]图形面积
题目来源:https://vijos.org/p/1056#include<bits/stdc++.h>using namespace std;const int maxn=100+10;int tot=1,n;struct data{ int x1,y1,x2,y2; bool read(){ scanf("%d%d%d%d",&x1,&y1,&x2,&y2)
2016-05-03 20:27:19 339
转载 字典树
const int maxnode = 4000 * 100 + 10;const int sigma_size = 26;// 字母表为全体小写字母的Triestruct Trie { int ch[maxnode][sigma_size]; int val[maxnode]; int sz; // 结点总数 void clear() { sz = 1; memset(c
2016-05-03 18:30:45 230
原创 洛谷P1908逆序对(离散化+树状数组)
题目来源:http://www.luogu.org/problem/show?pid=1908搞来搞去,还是SYZOJ自带代码框最好用#include#include#include#includeusing namespace std;const int maxn=40000+10;int n,c[maxn];struct data{ long long v;
2016-05-03 12:46:06 531
转载 离散化(Matrix67)
什么是离散化? 如果说今年这时候OIBH问得最多的问题是二分图,那么去年这时候问得最多的算是离散化了。对于“什么是离散化”,搜索帖子你会发现有各种说法,比如“排序后处理”、“对坐标的近似处理”等等。哪个是对的呢?哪个都对。关键在于,这需要一些例子和不少的讲解才能完全解释清楚。 离散化是程序设计中一个非常常用的技巧,它可以有效的降低时间复杂度。其基本思想就是在众多可能的情况中
2016-05-03 12:44:28 771
转载 二叉索引树(树状数组)
//inline int lowbit(int x) { return x&(x^(x-1)); }inline int lowbit(int x) { return x&-x; }struct FenwickTree { int n; vector C; void resize(int n) { this->n = n; C.resize(n); } void clear
2016-05-02 11:48:15 360
原创 bzoj1050:[HAOI2006]旅行comf
题目来源:http://www.lydsy.com/JudgeOnline/problem.php?id=1050话说我以后是不是也要把函数堆在一起了。。。//得到hzwer大神的题解#include#include#includeusing namespace std;#define INF 0x3fffffffint n,m,s,t;struct data{ in
2016-05-01 22:46:56 296
原创 高精
#include#include#include#includeusing namespace std;const int maxn=4000;struct BIGNUM{ int len,s[maxn]; BIGNUM(){memset(s,0,sizeof(s));len=1;} BIGNUM operator=(const char* num){ len=strlen
2016-04-30 14:03:38 238
转载 不知道是什么(ting)(shuo)效率很高的代码
题目来源:http://www.luogu.org/problem/show?pid=2661//%拜神犇tys #include#include#includeusing namespace std;const int maxn=200005;int vis[maxn];//这个点是第几次搜到的 int fa[maxn];int dfn[maxn];//深度记录 int
2016-04-29 07:56:11 519 1
原创 最短路
迪杰斯克拉:#include#include#include#include#includeusing namespace std;#define maxn 100002#define INF 100000000struct e{
2016-04-28 10:47:54 280
原创 酱油记OfHAOI@)!^
无力吐槽。。。。怎么说,有欢笑,有泪水吧,更多的是痛苦。和许多神犇一样,我们敬爱的学长XTT没进队,真的是很可惜,也许竞赛就是这样,残酷的现实,突然感觉本HA省蒟蒻必在明年此时退役,残酷的事实。啊,一个小惊喜是遇到了57大学霸(年级第一,语文百分制时他能考95,%%%)YFH,现在他在外语,引起了我很多童年时的回忆啊。%%%各位大神%%%十一中加油!
2016-04-28 08:15:52 276
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人