自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

退役狗的专栏

e ≈ 2.71828 18284 59045 23536 02874 71352 66249 77572 47093 69995 95749 66967 62772 40766 30353 5475

  • 博客(33)
  • 资源 (1)
  • 收藏
  • 关注

原创 【BZOJ】【P3043】【IncDec Sequence】【题解】【差分】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3043差分操作等价于+-1正的减负的加没了Code:#includeusing namespace std;const int maxn=1e5+5;int n,a[maxn];long long A,B;int main(){ scanf("%d",&n)

2015-01-29 21:03:58 941

原创 【BZOJ】【P3208】【花神的秒题计划Ⅰ】【题解】【记忆化搜索】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3208暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力Code:#includeusing namespace std;int n,m;int mp[701][701];int cant[701][701];int vis[701][701];int f[701][70

2015-01-29 20:54:32 873

原创 【BZOJ】【P1568】【JSOI2008】【Blue Mary开公司】【题解】【线段树】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=15683165弱化版Code:#includeusing namespace std;const int maxn=50001;int n=50000,m,ind;struct seg{ double k,b; int id; seg(int x0=0,int y0=

2015-01-28 20:55:18 1169

原创 【BZOJ】【P3165】【Heoi2013】【Segment】【题解】【线段树】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3165题解Code:#includeusing namespace std;const int maxn=40001;int n=39989,m,ind;struct seg{ double k,b; int id; seg(int x0=0,int y0=0,int

2015-01-28 20:41:30 883

原创 【BZOJ】【P2318】【Spoj4060 game with probability Problem】【题解】【概率DP】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2318Code:#includeusing namespace std;int main(){ int T,n; double p,q; static double f[1002],g[1002]; cin>>T; while(T--){ cin>>n>>p>

2015-01-28 13:28:15 1188

原创 【BZOJ】【P3239】【Discrete Logging】【题解】【BSGS】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3239裸题Code:#includeusing namespace std;typedef long long LL;LL p,a,b;LL pw(LL x,LL k,LL p){ LL ans=1; for(;k;k>>=1){ if(k&1)ans=(ans*x

2015-01-27 19:30:21 11138

原创 【BZOJ】【P2435】【Noi2011】【道路修建】【题解】【dfs】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2435说好的卡爆栈呢Code;#includeusing namespace std;const int maxn=1e6+5;struct edge{int v,w;};vectorG[maxn];typedef long long LL;LL sum=0,ans=0

2015-01-27 19:03:09 11111

原创 【BZOJ】【P1833】【ZJOI2010】【count 数字计数】【题解】【数位DP】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1833Code:#includeusing namespace std;typedef long long LL;LL F[13][11][11];LL f[13][11],ten[15];valarray solve(LL n){ if(!n){valarrayt

2015-01-27 15:58:39 996

原创 【BZOJ】【P1415】【Noi2005】【聪聪和可可】【题解】【期望DP】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1415Code:#includeusing namespace std;const int maxn=1005;int n,m,s,t;vectorG[maxn];double f[maxn][maxn];int next[maxn][maxn],pre[maxn]

2015-01-26 19:15:13 856 1

原创 【BZOJ】【P2730】【HNOI2012】【矿场搭建】【题解】【dfs】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2730暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力暴力Code:#includeusing namespace std;const int maxn=505;int n,m,T,now;vectorG[maxn];int col[maxn],cols,tmp[maxn],

2015-01-25 19:53:13 839

原创 【BZOJ】【P2729】【HNOI2012】【排队】【题解】【数学】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2729ans=n!*(A(n+1,2)*A(n+3,m)+2*(n+1)*A(n+2,m-1)*m)我的高精度已经废了Code:n,m=map(int,raw_input().split())fac=[1]*2010for i in range(1,2010):fac[i]

2015-01-25 15:59:14 824 2

原创 【BZOJ】【P2565】【最长双回文串】【题解】【manacher】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2565我已经吐了不知道是我的manacher模板有问题还是数据有问题总是T一个点题解Code:#includeusing namespace std;const int maxn=4e5+5;int n;char s[maxn],str[maxn];int f[m

2015-01-25 15:23:04 659

原创 【屯题计划】【#2】【17/50】

最近心态不好……会的题不想写,不会的题看题解变成会的题还是不想写于是每天就在点开题——关掉——点开——关掉中度过  = = 、还是屯题给自己点压力吧Q:你为什么每道题都发一篇文章而不是像别人在一篇里写好多题解?A:我要刷博客排名  = =、不好意思了

2015-01-25 09:59:29 1088

原创 【Dinic模板】

const int maxn=2005;struct edge{int u,v,cap,flow;};vectoredges;vectorG[maxn];int s,t;int cur[maxn],d[maxn];void add(int u,int v,int cap){ edges.push_back((edge){u,v,cap,0}); G[u].push_back(edg

2015-01-23 21:34:25 769

原创 【BZOJ】【P1322】【Zju2429 Destroying The Graph】【题解】【最小割】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1322点i拆为i和i's->i cap=Wi-i'->t cap=Wi+原图中的有向边u,vu->v' cap=inf最小割显然Code:#includeusing namespace std;const int maxn=205;struct edge{

2015-01-23 21:33:23 888

原创 【BZOJ】【P3881】【Coci2015】【Divljak】【题解】【AC自动机】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3881感谢TimeMachine神犇的提醒对S建AC自动机,记录每个串的末尾结点插入就是在fail树上跑一遍,把经过且本次没有访问过的结点ans++询问O(1)Code:#includeusing namespace std;const int maxn=10001

2015-01-21 20:33:09 2044 18

原创 【BZOJ】【P2073】【POI2004】【PRZ】【题解】【状压DP+枚举子集】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2073状压DP+枚举子集Code:#includeusing namespace std;int n,W;int w[18],t[18];int dp[1<<16],sum[1<<16],tim[1<<16];int main(){ cin>>W>>n; for(

2015-01-20 20:35:20 1290

原创 【BZOJ】【P3707】【圈地】【题解】【乱搞】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3707黄学长真是太强了!随机旋转坐标系,相邻的点暴力Code:#includeusing namespace std;int n,sqrtn,bel[1010],cnt,L[55],R[55];struct point{ double x,y; point(doubl

2015-01-20 20:20:14 635

原创 【BZOJ】【P1307&P1318】【题解】【max_element】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1307 http://www.lydsy.com/JudgeOnline/problem.php?id=1318抱着试一试的心态……A了……噗Code:#includeusing namespac

2015-01-19 20:59:23 1201

原创 【BZOJ】【P2654】【tree】【题解】【二分+MST】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2654考虑把白色边权加上一个值x,那么最小生成树中的白色边数量的可行最大值g(x)与可行最小值f(x)随x增大而减小,然后就可以二分一个x使得need∈[f(x),g(x)]Code:#include#define fst first#define sec secondusi

2015-01-15 09:24:47 959

原创 【BZOJ】【P2474】【订单】【题解】【贪心】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2474思考能力最近好像消失了……不能天天看题解啊啊啊啊贪心按左端点为第一关键字,右端点第二关键字sort我们能接客就接客,用multiset维护每个团队的可行时间,不能满足客户需求而且这个客户的结束时间比最晚得团队的可行时间还要小,那么踢掉以前的客户,接新的Co

2015-01-14 21:43:28 615

原创 【BZOJ】【P3210】【花神的浇花集会】【题解】【曼哈顿距离变形】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3210|x_1-x_2|+|y_1-y_2|=max(|(x_1+y_1)-(x_2+y_2)|,(x_1-y_1)-(x_2-y_2))Code:#includeusing namespace std;const int maxn=1e5+5;int n,a[maxn],b

2015-01-14 08:24:08 719

原创 【BZOJ】【P1976】【BeiJing2010组队】【能量魔方 Cube】【题解】【最小割】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1976题解:http://hi.baidu.com/edward_mj/item/13edebea70015f3d86d9dec0Code:#includeusing namespace std;const int maxn=40*40*40+10;struct edge{i

2015-01-13 21:24:15 847

原创 【BZOJ】【P2743】【HEOI2012】【采花】【离线+树状数组】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2743好像没什么可说的……Code:#includeusing namespace std;const int maxn=1e6+5;struct segment{int l,r,id;bool operator<(const segment o)const{return r

2015-01-12 21:59:54 599

原创 【BZOJ】【P3813】【奇数国】【题解】【树状数组】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=381360棵树状数组,光荣倒数第一Code:#include#define lw(x) (x&-x)using namespace std;const int maxn=1e5+5;const int M=19961993;struct BIT{ int d[maxn]

2015-01-10 20:47:30 975 2

原创 【BZOJ】【P2116】【Wc2011】【Joy】【题解】【差分+线段树+平衡树】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2116首先这道题第6、7个点数据有问题,差分后的的序列会有0然后看题第一问,把原序列差分,差分序列的正数和就是答案第二问实质上是扩展左区间的右端点和右区间的左端点使得得分下降,负数区间的权值为区间和减区间max,所以我们要维护区间和区间max,负数区间和支持前k小和的平衡树

2015-01-08 16:51:38 984

原创 【BZOJ】【P1293】【SCOI2009】【生日礼物】【题解】【水题】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1293排完序扫一遍,没了最近刷水太多了唉……Code:#include#define fst first#define sec secondusing namespace std;const int maxn=1e6+5;typedef pair par;int n

2015-01-07 07:11:41 754

原创 【BZOJ】【P3831】【Poi2014】【Little Bird】【题解】【单调队列+DP】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3831dp显然f[i]=min(f[j]+(d[j]单调队列优化最优解有可能是f[j]或f[k]+1之类的,先比较f,再比较d,它们是一样的(好像讲的不清楚= =、)Code:#includeusing namespace std;const int maxn=

2015-01-06 07:43:05 952

原创 【BZOJ】【P3834】【Poi2014】【Solar Panels】【题解】【分块统计】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3834设gcd(x,y)=k x∈[a,b] y∈[c,d]=>gcd(x/k,y/k)=1 x∈((a-1)/k,b/k] y∈((c-1)/k,d/k]这四个都只有sqrtn种取值……没了Code:#includeusing namespace std;int ma

2015-01-06 07:22:11 1192

原创 【BZOJ】【P2530】【Poi2011】【Party】【题解】【水题】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2530最近两天颓的厉害啊唉……==============分割线====================让在团里的和不在团里的两两抵消,剩下的就是Code:#includeusing namespace std;const int maxn=3010;bool g[m

2015-01-03 17:34:17 815

原创 【BZOJ】【P2295】【POJ Challenge】【我爱你啊】【题解】【水题】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2295傻逼题Code:#include#include#include#includeusing namespace std;const int maxn=1e5+5;int n;char s[maxn];char t[]="luvletter";int main

2015-01-02 18:23:54 1144

原创 【BZOJ】【P1758】【Wc2010】【重建计划】【题解】【点分治+二分+单调队列】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1758二分答案把边权减去mid,点分治判断是否有>=0,长度在[L,U]的路径单调队列优化Code:#includeusing namespace std;const double eps=1e-5;const int maxn=1e5+5;int dcmp(dou

2015-01-02 15:48:02 1471

原创 【BZOJ】【P2946】【Poi2000】【公共串】【题解】【hash】

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2946hash+二分大水题不说了其实主要是用来测试一下我的新笔记本,真是爽!!!还是不贴渣配置了吧- -|Code:#includeusing namespace std;typedef unsigned long long UL;int n,mn=2001,len[

2015-01-01 22:02:39 889

Gena评测机

为OIer开发的评测机!拖入exe和数据评测,下方正则表达式使用C风格

2014-09-09

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除