
模板
mhlwsk
这个作者很懒,什么都没留下…
展开
-
[POJ1273]草地排水 dinic模板
这题可以作为网络流模板看,这里贴一下自己的dinic模板#include <iostream>#include <algorithm>#include <cstring>#include <queue>#include <cstdio>using namespace std;const int inf=0x3fffffff,N=400,M=500;int d[N],head[N],ve原创 2016-03-02 14:05:50 · 1041 阅读 · 0 评论 -
[POJ2887]Big String 做题笔记
题目来源:http://poj.org/problem?id=2887 块状链表模板题#include <iostream>#include <cstring>#include <algorithm>#include <cstdio>using namespace std;#define N 1000010#define L 2020char s[N],c,opt;int n,po原创 2016-02-18 14:48:48 · 863 阅读 · 0 评论 -
[BZOJ1036]树的统计 做题笔记
题目来源:http://www.lydsy.com/JudgeOnline/problem.php?id=1036 Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QS原创 2016-02-18 14:54:41 · 526 阅读 · 0 评论 -
[CodeVS1204]寻找字串位置 做题笔记
kmp模板题,以下是kmp模板#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;char a[200],b[200];int p[200];int n,m;void get () { int i=0,j=-1; p[0]=-1;原创 2016-02-19 09:36:17 · 807 阅读 · 0 评论 -
[BZOJ1500]维修数列 做题笔记
题目来源:http://www.lydsy.com/JudgeOnline/problem.php?id=1500 自己做这题的一个非常有意思的收获,就是pushup和pushdown千万不能忽略“0”。一般我们会把不存在的孩子的id定为0,这里称之为void好了,按理来说这个void应该是个垃圾箱,扔进去的数据都会被吃掉。但是在pushdown时如果把不和谐的值扔了进去,pushup时是会从里面原创 2016-03-20 22:52:51 · 740 阅读 · 0 评论 -
[CodeVS2822]爱在心中 做题笔记
题目来源 :http://codevs.cn/problem/2822/ 题目描述 Description “每个人都拥有一个梦,即使彼此不相同,能够与你分享,无论失败成功都会感动。爱因为在心中,平凡而不平庸,世界就像迷宫,却又让我们此刻相逢Our Home。” 在爱的国度里有N个人,在他们的心中都有着一个爱的名单,上面记载着他所爱的人(不会出现自爱的情况)。爱是具有原创 2016-02-28 11:24:48 · 488 阅读 · 0 评论 -
[UOJ35]后缀排序 做题笔记
题目链接:http://uoj.ac/problem/35 这也是个后缀数组的模板题。。。#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int N=100009;char s[N];int r[N],wa[N],wb[N],wd[N],wv[N];int sa[N],r原创 2016-03-14 17:03:27 · 422 阅读 · 0 评论 -
[POJ2774]Long Long Message [CodeVS3160]最长公共子串 做题笔记
这题是后缀数组模板题。 一直在纠结到底是看SAM还是Suffix Array? 构造代码来自罗穗骞《后缀数组——处理字符串的有力工具》 构造代码一直看不懂QAQ,那就按ydc教主说的背下模板吧。主要应用是针对三个数组的。#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int原创 2016-02-20 10:33:13 · 441 阅读 · 0 评论 -
[POJ1325]机器调度 做题笔记
Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature o原创 2016-03-02 14:13:51 · 499 阅读 · 0 评论