自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

zy_sarah的专栏

前面的路还很远,你可能会哭,但一定要走下去,一定不要停~

  • 博客(19)
  • 收藏
  • 关注

转载 单调队列

一、 什么是单调(双端)队列单调队列,顾名思义,就是一个元素单调的队列,那么就能保证队首的元素是最小(最大)的,从而满足动态规划的最优性问题的需求。单调队列,又名双端队列。双端队列,就是说它不同于一般的队列只能在队首删除、队尾插入,它能够在队首、队尾同时进行删除。【单调队列的性质】一般,在动态规划的过程中,单调队列中每个元素一般存储的是两个值:1、在原数列中的位置(下标)2

2012-08-08 10:45:26 465

原创 bnu 12872 Array Diversity

Enough with this Harry Potter, please! What are we, twelve-year olds?  Let's get our teeth into some real pumpkin pasties -- oops, programming problems!Here we go!Let's define the diversity of a

2012-08-05 14:24:32 646

原创 hdu 4334 Trouble

Problem DescriptionHassan is in trouble. His mathematics teacher has given him a very difficult problem called 5-sum. Please help him.The 5-sum problem is defined as follows: Given 5 sets S_1,..

2012-08-04 00:01:15 458

原创 Codeforces Round #131 (Div. 2)

B. Hometasktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFurik loves math lessons very much, so he doesn

2012-08-01 16:07:12 880

原创 hdu 4320 Arcane Numbers 1

Problem DescriptionVance and Shackler like playing games. One day, they are playing a game called "arcane numbers". The game is pretty simple, Vance writes down a finite decimal under base A, and

2012-07-31 21:05:45 451

原创 hdu 4313 Matrix

Problem DescriptionMachines have once again attacked the kingdom of Xions. The kingdom of Xions has N cities and N-1 bidirectional roads. The road network is such that there is aunique path betw

2012-07-27 11:10:54 2179

原创 HDU 4311 Meeting point-1

Problem DescriptionIt has been ten years since TJU-ACM established. And in this year all the retired TJU-ACMers want to get together to celebrate the tenth anniversary. Because the retired TJU-ACM

2012-07-26 21:01:16 530

原创 UVALive 5865 Finding Bottleneck Shorstet Paths

题目链接:http://livearchive.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3876不知道比赛的时候是怎么想的,居然没有想到并查集,肯定是太久没做,失去对并查集的敏感度了。。。。数据范围比较小,所有的边也只有100W而已,明显可以过的。感觉就是最小

2012-07-25 16:49:13 494

转载 KMP算法详解

转载自http://www.matrix67.com/blog/archives/115如果机房马上要关门了,或者你急着要和MM约会,请直接跳到第六个自然段。    我们这里说的KMP不是拿来放电影的(虽然我很喜欢这个软件),而是一种算法。KMP算法是拿来处理字符串匹配的。换句话说,给你两个字符串,你需要回答,B串是否是A串的子串(A串是否包含B串)。比如,字符串A="I'm ma

2012-07-22 10:55:32 906

原创 HDU 4302 holedox eating

Holedox EatingTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 857    Accepted Submission(s): 292Problem DescriptionHoledox is a

2012-07-21 09:58:59 400

原创 手写最大堆

#include#includeusing namespace std;int heap[1000010];int tot;#define lson ((rt)<<1)//注意加外括号#define rson (((rt)<<1)|1)void query(int rt){ heap[1]=heap[--tot]; while(1) { if(lson<=tot ||

2012-07-18 13:49:10 543

转载 CodeForces #113 Div.2 E

题目:http://www.codeforces.com/problemset/problem/166/E题意:给你一个四面体,上面有四个顶点,有一只蚂蚁站在点D上。现在给你一个数字n(n分析:n很大,有10的7次方,所以DFS是必定超时的,所以我们要寻求更好的方法来解决问题。f[i] 表示走i步回到起点的方法数。我们再定义一个变

2012-07-18 10:10:46 760

原创 Codeforces Round #113 (Div. 2) D. Shoe Store

D. Shoe Storetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe warehouse in your shop has n shoe pairs.

2012-07-17 23:50:02 1156

原创 Codeforces Beta Round #86 (Div. 2 Only) B PFAST Inc.

B. PFAST Inc.time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen little Petya grew up and entered the uni

2012-07-14 23:29:07 1684

原创 Codeforces Beta Round #27 (Codeforces format, Div. 2) D Ring Road 2(二分图染色版)

D. Ring Road 2time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is well known that Berland has n cities, which form

2012-07-14 20:41:51 2059

原创 BNU 12889 Alice and Bob

Alice and BobTime Limit: 30000msCase Time Limit: 1000msMemory Limit: 65536KB 我不知道Alice和Bob到底发展到了哪一阶段,就像我不知道李雷最后有没有负了韩梅梅,同样的我也不知道奶牛Bessie是否逃出了Farmer John魔爪。撇开这些八卦不说,取石子游戏绝对是一款风靡ACM界的经

2012-07-14 16:00:06 764

原创 SPOJ Problem Set (classical) 11582. A Famous Grid

//螺旋数,很多时候不是你不会,是对未知的东西充满了恐惧//其实静下心来,这个螺旋数是完全可以写出来的,剩下的就是简单的bfs了//PS:图是无限大的,虽然x,y给出的范围是10000,也就是100*100的图,但是可以绕着走,所以要稍微开大一点儿#include#include#include#include#include#includeusing namespace st

2012-07-12 22:18:00 560 2

转载 关于dijkstra

//v表示起始点,n表示总点数,pre表示上一个点,dis[i]表示当前起始点到i的最短路径,c为所保存的邻接矩阵void dijkstra(int n,int v,int pre[],int dis[],int c[][]){ bool vis[maxn];//是否用过 for(int i=1;i<=n;i++)//初始化,从起始点开始有路径相连的更新,所有点都未走过,距离更新 {

2012-07-12 20:46:18 342

原创 hdu 3118 【关于二分图】

/*根据题意,本题要求为图中不能出现奇数环由此想到二分图的性质:图中的点分为两个集合,一个集合中的点只有另一个集合有连边,而不与自身集合内的点有连边,因为只有两个集合,所以要形成环必须为偶数条边一共最多有15个点,所以最多有2^15次方种情况*/#include#include#include#includeusing namespace std;int mapp[17][1

2012-07-12 20:42:29 504

空空如也

空空如也

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

TA关注的人

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