- 博客(12)
- 收藏
- 关注
原创 treap模板
测试,自动去重151 2 3 4 5 6-51 15 2 22 22 2 2 #include #include #include #include using namespace std;const int MAXN = 80005;const int INF=0x7fffffff;int ch[MAXN][2],
2016-04-29 22:35:07 267
转载 treap by:刘汝佳
备忘 白书代码的基础上有部分改进// Rank Tree// Rujia Liu// 输入格式:// m 操作有m个// 1 x 插入元素x// 2 x 删除元素x。如果成功,输入1,否则输出0// 3 k 输出第k小元素。k=1为最小元素// 4 x 输出值x的“名次”,即比x小的结点个数加1#includestruct Node { Node
2016-04-29 20:54:31 448
原创 hdu2222
ac自动机,模板题#include #include using namespace std;const int MAXN = 500000+5;const int LEN = 50+5;const int SIGMA = 26;char a[LEN],b[MAXN*2];int trie[MAXN][SIGMA],q[MAXN],f[MAXN],val[MAXN],vis[MA
2016-04-27 15:05:01 200
原创 codevs p1285
数据结构模板题set#include #include #include using namespace std;const int INF = 0x7fffffff;const int MOD = 1000000;int main(){ set s; s.clear(); s.insert(INF); s.insert(-INF); int n; int ans
2016-04-27 14:52:55 346
原创 BKDRHash
一个简单的hash#include #include using namespace std;unsigned ans=0;unsigned BKDRHash(char *str){ unsigned seed = 131; // 31 131 1313 13131 131313 etc.. unsigned hash = 0; while (*str)has
2016-04-27 14:51:44 394
原创 vijos p1233
描述在直角坐标系中,给出n个顶点的坐标,求这n个点所围成的图形的周长和面积。注意:(1)如果所有点共线则周长按直线的长度计算,面积视为0;(2)如果部分点共线按共线后的多边形计算;(3)所给出的n个顶点如果能围成多边形均为突多边形。#include <bits/stdc++.h>using namespace std;const double EPS = 1e...
2016-04-26 11:58:42 327
原创 二维计算几何通用模板
#include <algorithm>using namespace std;const double EPS = 1e-10;const double PI = acos(-1);struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {}};type...
2016-04-26 11:54:50 312
原创 ISAP(poj1273 / codevs1993)
关于ISAP:https://www.cnblogs.com/owenyu/p/6852664.html同时也是poj1273 / codevs1993的题解USACO的奶牛题,网络流模板这道题codevs上的数据很水...还要注意poj上是多组数据//poj1273 / codevs1993#include <queue>#include <cstdi...
2016-04-25 12:05:31 524
原创 费用流
//hdu3667#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll MAXN = 100 + 5;const ll INF = 0x3f3f3f3f3f3f3f3f;const ll MAXM = 50000 + 5;//边数,要开成两倍ll fst[MAXN], ...
2016-04-24 17:40:32 210
原创 后缀数组
//后缀数组,尚有bug#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>//#define rep(i, a, b) for(int i=a;i<b;i++)using namespace std;const int MAXN ...
2016-04-24 17:36:01 210
原创 AC自动机(HDU2222 HDU3065)
//HDU2222#include <bits/stdc++.h>using namespace std;const int MAXN = 500000 + 5;const int SIGMA = CHAR_MAX;int f[MAXN], last[MAXN];struct trie { int ch[MAXN][SIGMA]; int val[MA...
2016-04-24 17:30:06 257
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人