自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

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

转载 POJ-1860 Currency Exchange 【spfa判负环】

DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these c...

2017-05-19 19:30:00 103

转载 Codeforces-808D Array Division 【multiset】

DescriptionVasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of ...

2017-05-16 23:18:00 122

转载 HDU-1556 Color the ball 【差分数组】

Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input每个测试实例第一行为一个整...

2017-05-16 20:03:00 144

转载 ZOJ-2386 Ultra-QuickSort 【树状数组求逆序数+离散化】

DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the ...

2017-05-15 22:59:00 95

转载 POJ-2195 Going Home 【费用流】

DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each li...

2017-05-02 20:37:00 69

转载 AHU-743 多重部分和问题 【多重背包变种】

Description有n种不同大小的数字,每种各个。判断是否可以从这些数字之中选出若干使它们的和恰好为K。Input首先是一个正整数T(1<=T<=100)接下来是T组数据每组数据第一行是一个正整数n(1<=n<=100),表示有n种不同大小的数字第二行是n个不同大小的正整数ai(1<=ai<=100000)第三行是n个...

2017-05-02 13:41:00 87

转载 BZOJ-1588 [HNOI2002]营业额统计 【splay || set】

Description营业额统计 Tiger最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况。 Tiger拿出了公司的账本,账本上记录了公司成立以来每天的营业额。分析营业情况是一项相当复杂的工作。由于节假日,大减价或者是其他情况的时候,营业额会出现一定的波动,当然一定的波动是能够接受的,但是在某些时候营业额突变得很高或是很低,这...

2017-04-27 00:58:00 83

转载 splay模板

对于splay核心是旋转和伸展,其他操作基本都是利用伸展的特性: 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 #define M(a, b) memset(a, b, sizeof(a)) 5 const int N = 5e4 + 5; 6...

2017-04-26 17:06:00 74

转载 MST算法

Kruskal 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 #define M(a, b) memset(a, b, sizeof(a)) 5 const int N = 1e3 + 10, maxn = 1e4 + 10; 6 int ...

2017-04-25 08:44:00 322

转载 ZOJ-2788 Panic Room 【最小割】

IntroductionYou are the lead programmer for the Securitron 9042, the latest and greatest in home security software from Jellern Inc. (Motto: We secure your stuff so YOU can't even get to it)....

2017-04-24 20:31:00 90

转载 倍增法求LCA

1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<vector> 5 #include<set> 6 #include<map> 7 #include<queue> 8 ...

2017-04-23 10:51:00 55

转载 ZOJ-1157 A Plug for UNIX 【最大流】

ProblemYou are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of in...

2017-04-20 21:55:00 107

转载 POJ-1273 Drainage Ditches 【最大流】

DescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time...

2017-04-20 19:59:00 74

转载 POJ-1236 Network of Schools 【强连通分量+缩点】

DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes softwar...

2017-04-18 22:32:00 82

转载 AHU-835 FJ的旅行 【最小费用最大流】

Description每当西瓜的朋友来西瓜家看他,西瓜总是喜欢带他们逛自己的豪宅。西瓜的豪宅有N幢楼(1<=N<=1000),用1到N的整数编号。1号楼是西瓜豪宅的大门,N号楼是西瓜的储藏室。西瓜的豪宅里总共有M条道路(1<=M<=10000)。每条道路连接两栋不同的楼房,道路的长度不超过35000。为了最好地炫耀他的豪宅,西瓜准备从大门出发,经过一些楼房...

2017-04-17 21:38:00 97

转载 最小费用最大流算法

1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 #define M(a, b) memset(a, b, sizeof(a)) 5 const int N = 1e3 + 5; 6 struct Edge { 7 int from, t...

2017-04-17 21:32:00 92

转载 最短增广路算法

Dinic算法 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 #define M(a, b) memset(a, b, sizeof(a)) 5 const int N = 1e3 + 5; 6 struct Edge { 7 ...

2017-04-17 20:34:00 205

转载 HFUT-1360 单身晚会 【SPFA】

Description ​ZJ和ZCX在一起很久了,两个人都互生爱意,最终决定喜结良缘,从此踏入浪漫的婚姻殿堂。但是,ZJ的好基友们想到以后ZJ就不能经常跟他们一起愉快的玩耍了,都觉得非常伤心难过,于是他们决定在最后一晚为ZJ开一场单身晚会,玩整晚紧张刺激的飞行棋。ZJ的好基友居住在城市的各个地方(每个地方不一定只有一个基友),他们需要从各个地方赶到其中一个朋友的家...

2017-04-16 12:51:00 80

转载 UVA-11324 The Largest Clique 【有向图强连通+缩点+DP】

题目链接:https://vjudge.net/problem/UVA-11324题目大意:给定一张有向图G,求一个结点数最大的结点集,集合中每两个点都至少有一条路径相连(方向任意)。题解:易知如果一个点被选择,则它所在强连通分量中的其他点也一定要选,如果不选,则其他点也不可选,因此先求出强连通分量,利用缩点创建出另一张有向图G2,每个结点的权值就是该强连通分量的...

2017-04-15 22:17:00 75

转载 有向图的强连通分量

两次dfs模板: 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define INF 0x3f3f3f3f 4 #define M(a, b) memset(a, b, sizeof(a)) 5 const int N = 1000 + 5; 6 int vis[N], sccno[N]...

2017-04-15 21:39:00 63

转载 UVA-10765 Doves and bombs 【双连通分量】

题目链接:https://vjudge.net/problem/UVA-10765题目大意:一个无向图中,求去掉每个点后的连通分量的数量。题解:这题实际上是求割顶,记录一下割顶的子孙当中反向边不在它之上的连通分量数量,最后加上图初始的连通分量数量。代码: 1 #include<bits/stdc++.h> 2 using namespa...

2017-04-15 20:45:00 253

转载 单调队列入门

给你一个长度为N的数组,一个长为K的滑动的窗体从最左移至最右端,你只能见到窗口的K个数,每次窗体向右移动一位,如下表: 你的任务是找出窗口在各位置时的max value,min value.单调队列的入门题,单调队列我的理解有对时间和大小都单调,只会在队列两端进行操作(队尾前移看大小,队头后移看时间),不会有元素插入到之前的两元素之间,因此每次都能保证队头元素是符合要求的...

2017-04-15 19:45:00 63

转载 无向图的双连通分量

点双连通分量模板(Tarjan算法) 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define M(a, b) memset(a, b, sizeof(a)) 4 #define INF 0x3f3f3f3f 5 const int N = 1000 + 5; 6 int pre[N]...

2017-04-13 21:44:00 69

转载 HFUT-1363 木条染色 【线段树+离散化】

Description 小明是一个非常浪漫的画家,他喜欢画各种奇奇怪怪的画,虽然没人理解他画的究竟是什么东西。有一天,他突发奇想,对于一根木条,他每次从木条中选取一个区间[l,r]进行染色,经过多次染色后,他想知道在[a,b]区间中有几个未被染色的子区间?可惜小明虽然画画非常厉害,但是并不擅长解决这类问题,于是,他拿着这根木条来找你,希望你能够给他帮助。假...

2017-04-09 15:37:00 105

转载 POJ-2513 Colored Sticks 【欧拉通路+Trie】

DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the en...

2017-04-07 21:51:00 95

转载 POJ-1275 Cashier Employment 【差分约束+二分】

DescriptionA supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hired you to help him, solve his problem. The p...

2017-04-07 18:05:00 101

转载 POJ-1364 King 【差分约束】

DescriptionOnce, in one kingdom, there was a queen and that queen was expecting a baby. The queen prayed: ``If my child was a son and if only he was a sound king.'' After nine months her chil...

2017-04-06 22:19:00 95

转载 线段树扫描线求矩形面积并

1.HDU-1542 AtlantisProblem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the...

2017-04-02 23:04:00 106

转载 BZOJ-1103 [POI2007]大都市meg 【DFS序+树状数组】

Description  在经济全球化浪潮的影响下,习惯于漫步在清晨的乡间小路的邮递员Blue Mary也开始骑着摩托车传递邮件了。不过,她经常回忆起以前在乡间漫步的情景。昔日,乡下有依次编号为1..n的n个小村庄,某些村庄之间有一些双向的土路。从每个村庄都恰好有一条路径到达村庄1(即比特堡)。并且,对于每个村庄,它到比特堡的路径恰好只经过编号比它的编号小的村庄。...

2017-04-01 19:00:00 82

转载 安徽大学第九届程序设计竞赛决赛题解

A.调酒师很水的一道题,算出每个参数的最小值就行,手速选手被碾压的开始QAQ。 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() { 5 //freopen("in.txt", "r", stdin); 6 int T; 7 int ...

2017-03-27 22:59:00 303

转载 ZOJ-1952 Heavy Cargo 【Floyd】

DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is...

2017-03-27 21:05:00 106

转载 HDU-3333 Turing Tree 【树状数组+离线处理+离散化】

Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solution. As well, wily 3xian made lo...

2017-03-24 13:20:00 140

转载 BZOJ-2743 [HEOI2012]采花 【树状数组+离线处理】

Description萧芸斓是Z国的公主,平时的一大爱好是采花。今天天气晴朗,阳光明媚,公主清晨便去了皇宫中新建的花园采花。花园足够大,容纳了n朵花,花有c种颜色(用整数1-c表示),且花是排成一排的,以便于公主采花。公主每次采花后会统计采到的花的颜色数,颜色数越多她会越高兴!同时,她有一癖好,她不允许最后自己采到的花中,某一颜色的花只有一朵。为此,公主每采一朵花,要...

2017-03-23 22:06:00 93

转载 SPFA算法模板

SPFA是队列优化后的Bellman-Ford,用于求带负权边的最短路,然而传说中O(k*n)的复杂度好像是错误的。 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<string> 5 #include<set&...

2017-03-22 22:12:00 61

转载 AHU-727 美妙音乐 【DP】

Description西瓜和Roll组团去冒险,他们打开了隐藏的密门,发现了矮人矿洞的秘密。那是多年前由矮人王亲自下令改建的密室,据说只有最美妙的音乐可以指引他们找到宝藏。一首音乐是最美妙的,当且仅当每两个相邻音符的和谐度之和最大。西瓜发现了一张矮人公认的最美和谐度表harmony。西瓜发现,他可以使用m种音符构造音乐,最终构成的音乐共包含n个音符。西瓜兴致勃勃地谱出了最美妙的音...

2017-03-22 19:12:00 73

转载 ZOJ-1610 Count the Colors 【线段树+区间更新】

DescriptionPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you c...

2017-03-21 20:17:00 66

转载 LCA问题【RMQ+Tarjan】

LCA-求树上两点最近公共祖先问题lrj的紫书上提供了一种将LCA问题转化为RMQ问题的方法,即dfs一次处理出一个序列,first(u)代表u第一次出现的下标,则对于u,v的最近公共祖先的下标即为RMQ(first(u), first(v))。LCA->RMQ(在线处理): 1 #include<bits/stdc++.h> 2 using nam...

2017-03-20 21:23:00 96

转载 POJ-1651 Multiplication Puzzle 【区间DP】

DescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of po...

2017-03-20 17:30:00 62

转载 HDU-2222 Keywords Search 【AC自动机】

Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system.Every imag...

2017-03-15 00:43:00 66

转载 HDU-1263 水果 【模拟+map的嵌套】

Problem Description夏天来了~~好开心啊,呵呵,好多好多水果~~Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.Input第一行正整数N(0<N<=10)表示有N组测试数据.每组测试数据的第一行是一个整数M(0&...

2017-03-13 19:36:00 101

空空如也

空空如也

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

TA关注的人

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