自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

willinglive

///////////////////////////////////AFO★★★★★★★★★★★★★

  • 博客(70)
  • 资源 (2)
  • 收藏
  • 关注

原创 【bzoj 1025】: [SCOI2009]游戏

http://www.lydsy.com/JudgeOnline/problem.php?id=1025if(prim[i]>n) break;又错在这里了n>=997就会WA还好有90分//#define _TEST _TEST#include #include #include #include #include #include using

2014-12-31 16:06:12 445

原创 【二次剩余】【bzoj 1406】: [AHOI2007]密码箱

http://www.lydsy.com/JudgeOnline/problem.php?id=1406x^2=1(mod n)(x+1)(x-1)=kn这个时候很关键不能说充要条件为x+1|n且x-1|n,因为这是最小公倍数正确的方法是枚举n=a*b#define _TEST _TEST#include #include #include #inc

2014-12-31 14:41:10 671

原创 【bzoj 1966】: [Ahoi2005]VIRUS 病毒检测

http://www.lydsy.com/JudgeOnline/problem.php?id=1966带'*'和'?'的匹配,DP,单次O(n^2)//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/*********

2014-12-31 09:23:03 1722 2

原创 【逆元】【bzoj 1965】: [Ahoi2005]SHUFFLE 洗牌

http://www.lydsy.com/JudgeOnline/problem.php?id=1965PoPopQQQ:x*2^m==l (mod n+1)x=(n/2+1)^m*l mod n+1表示只推导出了第一步,居然一样。。。#define _TEST _TEST#include #include #include #include

2014-12-30 21:44:17 464

原创 【贪心】【bzoj 3008】: 象棋

http://www.lydsy.com/JudgeOnline/problem.php?id=3008本题的难点是“移动过程中不能出现多颗棋子同时在某一格的情况”。事实上,可以忽略此条件,因为棋子是相同的,我们可以用合法的等效方案替代一棋子越过另一棋子的情况: A、B、C三格,A能在一步走到B,B也能在一步走到C。在A的棋子需要走到存在棋子的B,接着走到C。此情形我们可以

2014-12-30 18:12:50 766

原创 【组合计数】【bzoj 3294】: [Cqoi2011]放棋子

http://www.lydsy.com/JudgeOnline/problem.php?id=3294啊哈哈哈做了近1.5h开始我按余行江的做,就把g数组的k从1-250都枚举了一遍理论上TLE,bzoj上却RE!!!!????没找到为什么,突然发现k是没有参与递推的,又改了很久很久最后因为少取了个模!!!!!找了半个多小时啊还是不要秀智商了,上代码——

2014-12-30 17:33:28 855

原创 【bzoj 3004】: 吊灯

http://www.lydsy.com/JudgeOnline/problem.php?id=3004合法的方案一定是n的一个约数。首先穷举n的约数m。对于一个结点,假设可以统计出所有子树中未分组的结点个数,设未分组的结点个数加上它自身的值为k,那么:1、 若k>m,那么这个方案一定不可行;2、 若k=m,那么这个结点一定是与这些未分组的点分在一起;3、 若k设s

2014-12-30 13:51:14 539

原创 【最小割】【bzoj 3774】: 最优选择

http://www.lydsy.com/JudgeOnline/problem.php?id=3774tm这最小割能考到这么变态是一种境界//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/********

2014-12-29 09:38:54 1000

原创 【bzoj 1925】: [Sdoi2010]地精部落

http://www.lydsy.com/JudgeOnline/problem.php?id=1925蒟蒻又是不会啊题解1http://hi.baidu.com/wjbzbmr/item/da020be63f6f41f92b09a410题解2http://www.cnblogs.com/zhber/p/4036040.html#define _TE

2014-12-27 17:50:13 727

原创 【bzoj 1880】: [Sdoi2009]Elaxia的路线

http://www.lydsy.com/JudgeOnline/problem.php?id=1880我智商低,这种标准noip难度的题都要想个几分钟先spfa 4遍x1、x2、y1、y2的最短路,再求都可以经过的点集和都可以经过的边集求一遍最长链即可

2014-12-27 14:57:11 865

原创 【状压DP】【bzoj 1226】: [SDOI2009]学校食堂Dining

http://www.lydsy.com/JudgeOnline/problem.php?id=1226及其恶心的状压,又抄标程去了。。。//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/***************

2014-12-26 20:05:17 892

原创 【贪心】科比的比赛

http://tieba.baidu.com/p/1433085358这道题啊首先【m仔细想一下,其实每一组贪心一下排序取前10个就行了,这里很不容易想到,因为很少见第一问如果是我,乘法log变加法,再套个网络流(似乎爆搜都行)第二问状压DP乱搞一下就可以主要是突破了坑点,这题就很水了

2014-12-26 11:47:15 794

原创 【IDDFS】【vijos 1350】C数列

https://vijos.org/p/1350贪心+IDDFS数列生成的原则一定是ai=ai-1+aj(j为什么呢?假设ai的分解中没有ai-1那么ai-1这个数就是毫无用处的,删掉更优有了这个突破口就可以搜索了还有因为OJ数据弱,这份代码像999,997都是TLE的要是在考场上,,,,,果断打表。。。。。//#define _TEST

2014-12-26 11:18:16 516

原创 【三分法】【bzoj 3330】: [BeiJing2013]分数

http://www.lydsy.com/JudgeOnline/problem.php?id=3330下面画了那么一大幅图告诉你是单峰函数,赶紧套三分//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/********

2014-12-25 21:47:37 1527

原创 【bzoj 3504】: [Cqoi2014]危桥

http://www.lydsy.com/JudgeOnline/problem.php?id=3504先求一次最大流,再交换b1,b2求一次最大流注意交换的技巧//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/*

2014-12-25 20:32:18 939

原创 【线性筛】【bzoj 3309】: DZY Loves Math

http://www.lydsy.com/JudgeOnline/problem.php?id=3309哇呀线性筛好神奇啊jcvb:类似的方法化简得记,并不是积性函数。观察的取值可以发现,;否则,当时,;否则,中存在两个质因子的次数不相同,。上述性质容易通过展开得到证明。这样,在线性筛的同时记录的最小质因子的次数,以及即可。

2014-12-24 16:57:31 1102

原创 【容斥原理】【poj 2773】Happy 2006

http://poj.org/problem?id=2773求第k大与n互质的数,二分+莫比乌斯水过据说写dfs的容斥原理可以0ms对此我表示hehe//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/*****

2014-12-24 10:40:10 496

原创 【经典贪心】【bzoj 1707】: [Usaco2007 Nov]tanning分配防晒霜

http://www.lydsy.com/JudgeOnline/problem.php?id=1707啊这么简单的贪心都不会。。。。。要是比赛只会匹配等TLE。。。。pty:如:按spf从小到大排序,从当前可选集合中选出合法的,再按max从小到大排序,选择前sum个即可证明:这个应该是可以从证明不存在增广路的角度来看的:就是目前贪心地选了,以后肯定存在

2014-12-23 22:06:55 1072 1

原创 【AC自动机+数位DP】【zoj 3494】BCD Code

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3494这题没什么好说的,就是数位DP,用AC自动机预处理一下就行了总体来说还是很裸的,但是有点恶心,还要高精度//#define _TEST _TEST#include #include #include #include #includ

2014-12-23 20:18:47 557

原创 【AC自动机】【bzoj 2938】: [Poi2000]病毒

http://www.lydsy.com/JudgeOnline/problem.php?id=2938自从zky发了题解之后,这题做的人蛮多的我也来写一写就是建图之后再判环就可以了//#define _TEST _TEST#include #include #include #include #include #include #includ

2014-12-23 11:34:22 577

原创 【AC自动机】【bzoj 1030】: [JSOI2007]文本生成器

http://www.lydsy.com/JudgeOnline/problem.php?id=1030大水B题啊//#define _TEST _TEST#include #include #include #include #include #include #include using namespace std;/*****************

2014-12-23 09:47:38 547

原创 【hall定理】一个关于二分图的问题

Loriex提出的问题:一个n行s列的矩阵(s已知1..n中每一个数在这个矩阵中都出现了s次,且同一行不含有相同的数。现在可以任意交换同一行中的任意两个数。求证 一定能通过交换得到一个n*s的矩阵 使得其每一列都是一个1..n的排列转化为hall定理即可hall定理证明:http://www.cnblogs.com/zxfx100/archi

2014-12-20 17:14:46 4547

原创 【置换群】【bzoj 1697】: [Usaco2007 Feb]Cow Sorting牛排序

http://www.lydsy.com/JudgeOnline/problem.php?id=1697hehe裸置换群//#define _TEST _TEST#include #include #include #include #include #include #include using namespace std;/**************

2014-12-20 13:49:53 614

原创 【置换群】【bzoj 1004】: [HNOI2008]Cards

http://www.lydsy.com/JudgeOnline/problem.php?id=1004套个DP,QAQ//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/************************

2014-12-20 12:57:25 448

原创 【bzoj 3624】: [Apio2008]免费道路

http://www.lydsy.com/JudgeOnline/problem.php?id=3624简单的贪心。//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/********************

2014-12-20 10:29:02 463

原创 【bzoj 3142】: [Hnoi2013]数列

http://www.lydsy.com/JudgeOnline/problem.php?id=3142ans=N*M^(K-1)-M^(K-1)*(K-1)*(M+1)/2#define _TEST _TEST#include #include #include #include #include #include using namespace std

2014-12-20 08:48:35 966

转载 【bzoj 3339】: Rmq Problem

http://ejq.me/2014/01/15/bzoj3339/这道题还是在这里贴一下吧2333http://blog.ejq.me/oi/2014/01/15/bzoj3339/题解在这里我用的离线做法我们得知道以下几点内容:从某一项开始的mex是单调不减序列从第i项开始的mex序列能通过从第i−1项开始的mex序列在O(n

2014-12-19 08:54:44 531

原创 【最大团】【bzoj 3632】: 外太空旅行

http://www.lydsy.com/JudgeOnline/problem.php?id=3632裸一般图最大团http://www.cnblogs.com/zhj5chengfeng/archive/2013/07/29/3224092.html//#define _TEST _TEST#include #include #include #incl

2014-12-17 19:18:07 877

原创 【bzoj 1024】: [SCOI2009]生日快乐

http://www.lydsy.com/JudgeOnline/problem.php?id=1024n//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/*******************************

2014-12-17 07:24:45 441

原创 【旋转卡壳】【bzoj 1069】: [SCOI2007]最大土地面积

http://www.lydsy.com/JudgeOnline/problem.php?id=1069枚举对角线就可以啦~//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/**********************

2014-12-16 21:48:57 515

原创 【树链剖分】【bzoj 1146】: [CTSC2008]网络管理Network

http://www.lydsy.com/JudgeOnline/problem.php?id=1146以前看来是一道神题,今天终于A了二分+树链剖分+树套树 4个log 2333333由于写得非常模块化,所以代码写起来有点长,但是写完了只改了两个地方!!!思路写得很清晰,以后写主席树我貌似很落后诶、、、//#define _TEST _TEST#

2014-12-16 20:30:32 658

原创 【混合图欧拉路判定】【poj 1637】Sightseeing tour

http://poj.org/problem?id=1637题解:http://www.cnblogs.com/kuangbin/p/3537525.html//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/***

2014-12-16 10:09:13 506

原创 【最小割】【hdu 4307】Matrix

http://acm.hdu.edu.cn/showproblem.php?pid=4307我曾经一直以为bfs比dfs快,知道我今天放弃这个想法了,怎么也赶不上dfs。。。。以后还是用bfs+dfs吧。。。。。第4次换模板。。。。。。hhhhh。我真好笑公式我写出来了,照着公式建图就可以了//#define _TEST _TEST#inclu

2014-12-15 15:08:29 448

原创 【一堆网络流】

最小割HDU 3452:根节点连S,叶子节点连T,求最小割HDU 3987:首先想到费用流,但是费用都为1,所以可以通过改变边权来实现

2014-12-15 08:02:33 457

原创 【最小割】【poj 3469】 Language

http://poj.org/problem?id=3469看到有个人也用bfs+bfs,于是我把自己的模板和他的综合了一下,快了一点,但还是比他慢得多,不止为何。。。。。。。。。。。。//#define _TEST _TEST#include #include #include #include #include #include using namespa

2014-12-13 17:52:29 393

原创 【树形DP】【多叉转二叉】【poj 1947】Rebuilding Roads

http://poj.org/problem?id=1947对多叉转二叉不是很熟悉,参考了下别人的代码,写得很好//#define _TEST _TEST#include #include #include #include #include #include using namespace std;/****************************

2014-12-12 20:36:33 504

原创 【树形DP】【HDU 4276】The Ghost Blows Light

http://acm.hdu.edu.cn/showproblem.php?pid=4276给定一颗带点权边权的树,求一条1-n的可重复经过的路径使得经过的总边权在时间范围内,且总点权最大(点权只能取一次)先bfs1-n的路径,时间减掉,点权边权设为0再从n点,DP一次,算从n点出发的总点权最大蒟蒻懒得写代码了

2014-12-12 20:12:42 514

原创 【树形DP】【poj 2057】The Lost House

http://poj.org/problem?id=2057这道题很久以前就看到过,一直没看懂题,所以就一直放着先学好英语,然后就可以做了这篇论文里讲得很清楚http://wenku.baidu.com/link?url=t2T0VjAbXPHk1tEM0o8f8orqAbDT34Xs0mAGDq4fxylFsla1RENJhrWgPmq6P7-DkhenpY9ASThFD

2014-12-12 15:10:47 470

原创 【矩阵模板】【hdu 1575】Tr A

http://acm.hdu.edu.cn/showproblem.php?pid=1575裸矩阵快速幂,从来没有写过模板,每次都是乱搞,写得乱七八糟的,以后统一写struct//#define _TEST _TEST#include #include #include #include #include #include using namespace st

2014-12-12 10:55:38 427

原创 【后缀数组】【URAL 1297】Palindrome

http://acm.timus.ru/problem.aspx?space=1&num=1297基本应用——最长回文子串不想写了,说下思路其实这道题就是暴力+优化枚举中间点,求两边的LCP于是需要RMQ预处理没了

2014-12-12 10:08:30 453

迷你C++ 6.0版本

非常迷你的Visual C++, 6.0版本 一分钟安装

2013-02-19

分享100个漂亮的图标图标

分享100个漂亮的图标图标,写程序很有用哦!

2013-02-19

空空如也

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

TA关注的人

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