上一页 1 2 3 4 5 6 7 8 ··· 22 下一页
摘要: 思路:利用它的几条性质#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 20010#define Maxm 2000010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (xdfn[u]) return 0; low[u]=min(low[u],low[v]); ... 阅读全文
posted @ 2013-09-17 21:32 fangguo 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #define mul(a) (a)*(a)using namespace std;const int Maxn = 210;const int Maxm = 100010;const int inf = 0x3f3f3f3f;struct ZKW_flow{ int st, ed, ecnt, n; int head[Maxn]; int cap[Maxm], cost[Maxm], to[Maxm], next[Maxm]; void init(){ memset(head, -1... 阅读全文
posted @ 2013-09-17 18:02 fangguo 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 思路:这个树链剖分其实还是比较明显的。将边按权值排序后插入线段树,然后用线段树查找区间中比某个数小的数和,以及这样的数的个数。当AB的情况比较 建一条由S->T的管子后将这根管子容量扩到最大能得到的容量 与 将所有预算都用来扩大管子容量不建新管子得到的最大容量 做比较 ,选最大的。扩容量能得到的最大权值可以同过二分枚举答案,用树链剖分判断。#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pa 阅读全文
posted @ 2013-09-16 23:27 fangguo 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 思路:特水的一个最长回文子序列动态规划。比赛时硬卡第一题,49WA后终于AC,可惜没时间做这题,结果成绩也就可想而知了。兔子跳一样权值的石头,并且一个正跳,一个反跳,这不就是个回文子序列吗?????!!!!#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 1010#define Maxm 200010#define LL __int64#define Abs(x) 阅读全文
posted @ 2013-09-16 10:03 fangguo 阅读(446) 评论(0) 推荐(0) 编辑
摘要: 思路:1003是大水题#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 100010#define Maxm 200010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x=4&&str[l-1]=='u'&&str[l-2]== 阅读全文
posted @ 2013-09-14 19:19 fangguo 阅读(721) 评论(0) 推荐(0) 编辑
摘要: 思路:将边权排序,然后插入线段树,这样就可以直接用二分查找确定答案。#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 100010#define Maxm 200010#define LL __int64#define Abs(x) (( 阅读全文
posted @ 2013-09-14 11:28 fangguo 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 思路:二分查找位置,之后是裸的树状数组。#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 100010#define Maxm 200010#define LL int#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x=val[i]-d) l--; if(sorted[r]>val[i]+d||r... 阅读全文
posted @ 2013-09-13 21:30 fangguo 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 思路:树链剖分入门题,我这门入得好苦啊,程序很快写出来了,可是在LCA过程中把update函数里的左右边界位置写反了,一直RE到死。#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 50010#define Maxm 200010#def 阅读全文
posted @ 2013-09-13 13:57 fangguo 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 思路:裸的DLX解数独。关键是建图,感觉还不如写个dfs直接,DLX写这个的代码很烦。#include#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 400010#define Maxm 200010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x<<1)#define rso 阅读全文
posted @ 2013-09-12 19:16 fangguo 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 思路:dp[i]表示到第i个点为结尾能获得的最大值,那么dp[i]=h[i]*h[i]+dp[i-x]-h[i-x];(i-l#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 100010#define Maxm 80002#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x>1; }}tree[Maxn 阅读全文
posted @ 2013-09-12 13:14 fangguo 阅读(519) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 22 下一页