![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
题解
dengcchh
这个作者很懒,什么都没留下…
展开
-
最短路
迪杰斯克拉: #include #include #include #include #include using namespace std; #define maxn 100002 #define INF 100000000 struct e{原创 2016-04-28 10:47:54 · 270 阅读 · 0 评论 -
【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 · 439 阅读 · 0 评论 -
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 · 350 阅读 · 0 评论 -
[离散化]图形面积
题目来源: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 · 333 阅读 · 0 评论 -
字典树
const int maxnode = 4000 * 100 + 10; const int sigma_size = 26; // 字母表为全体小写字母的Trie struct Trie { int ch[maxnode][sigma_size]; int val[maxnode]; int sz; // 结点总数 void clear() { sz = 1; memset(c转载 2016-05-03 18:30:45 · 225 阅读 · 0 评论 -
bzoj1050:[HAOI2006]旅行comf
题目来源:http://www.lydsy.com/JudgeOnline/problem.php?id=1050 话说我以后是不是也要把函数堆在一起了。。。 //得到hzwer大神的题解 #include #include #include using namespace std; #define INF 0x3fffffff int n,m,s,t; struct data{ in原创 2016-05-01 22:46:56 · 285 阅读 · 0 评论 -
洛谷P1908逆序对(离散化+树状数组)
题目来源:http://www.luogu.org/problem/show?pid=1908 搞来搞去,还是SYZOJ自带代码框最好用 #include #include #include #include using namespace std; const int maxn=40000+10; int n,c[maxn]; struct data{ long long v;原创 2016-05-03 12:46:06 · 518 阅读 · 0 评论 -
离散化(Matrix67)
什么是离散化? 如果说今年这时候OIBH问得最多的问题是二分图,那么去年这时候问得最多的算是离散化了。对于“什么是离散化”,搜索帖子你会发现有各种说法,比如“排序后处理”、“对坐标的近似处理”等等。哪个是对的呢?哪个都对。关键在于,这需要一些例子和不少的讲解才能完全解释清楚。 离散化是程序设计中一个非常常用的技巧,它可以有效的降低时间复杂度。其基本思想就是在众多可能的情况中转载 2016-05-03 12:44:28 · 757 阅读 · 0 评论 -
二叉索引树(树状数组)
//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 · 346 阅读 · 0 评论 -
不知道是什么(ting)(shuo)效率很高的代码
题目来源:http://www.luogu.org/problem/show?pid=2661 //%拜神犇tys #include #include #include using namespace std; const int maxn=200005; int vis[maxn];//这个点是第几次搜到的 int fa[maxn]; int dfn[maxn];//深度记录 int转载 2016-04-29 07:56:11 · 509 阅读 · 1 评论 -
高精
#include #include #include #include using 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 · 229 阅读 · 0 评论