自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 UVa 1400 "Ray, Pass me the dishes!"(线段树)

题目链接:http://acm.hust.edu.cn/vjudge/problem/36216大意:给出n个数m个询问,对于每个询问(a,b),求【a,b】区间内的最大连续和区间【x,y】,若有多组解,二元组(x,y)

2016-08-31 21:15:28 470

原创 UVa 1329 Corporative Network(并查集)

题目链接:http://acm.hust.edu.cn/vjudge/problem/36132大意:给出n个结点,一系列操作。对于操作I,输入u,v,把u的父结点设为v,距离为|u-v|mod1000;对于操作E,输入u,输出u到根结点的距离。思路:

2016-08-29 16:23:38 409

原创 UVALive 6811 Irrigation Lines(匈牙利算法)

题目链接:http://acm.hust.edu.cn/vjudge/problem/73800题意:给出若干行01串,每次可以消掉一行1或一列1,问最少几次能把所有的1消完。思路:  我们可以把每一行看做X点集中的一个点,每一列看做Y点集中的一个点,如果第i行第j列为1,就从X点集中的对应的点i向Y点集中的点j连一条边。这样问题就转化成了,给               出一个二分图,用

2016-08-25 10:47:00 378

原创 UVa 11235 Frequent values (RMQ)

题目链接:http://acm.hust.edu.cn/vjudge/problem/23846大意:给出一个非降序排列的数组,对于一系列询问(i,j),输出ai——aj中出现次数最多的值出现的次数。思路:因为数组是按非降序给出的,所以相同的元素一定会连续出现,因此可以对每个数字进行编号(即该数字是)

2016-08-23 19:38:17 290

原创 UVa 1428 Ping pong (树状数组)

题目链接:http://acm.hust.edu.cn/vjudge/problem/36244题目大意:给出n个不同的数,从左到右按顺序选出三个a1,a2,a3,使得a1>a2&&a2a3,问有多少种选法。思路:本题的关键在于,对于任意一个数,怎样快速求出它的两边各有多少个数比它大(小)。我们以左边为例,假设当前的数为a[i],那么它的左边比它小的数的个数即为1,2,3.

2016-08-20 20:31:20 376

原创 UVa 11584 Partitioning by Palindromes(DP)

题目链接:http://acm.hust.edu.cn/vjudge/problem/34398题意:给出一个字符串,把它划分成尽量少的回文串。没想到用O(n3)的暴力也能过,看来是数据太水。思路:dp[i]表示前i个字符能划分成的最小回文串数,设j#include#include#include#include#include#inclu

2016-08-19 18:59:13 310

原创 POJ 3311 Hie with the Pie(状态压缩DP)

Hie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 6776 Accepted: 3652DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to

2016-08-18 19:48:28 269

原创 POJ 2187 Beauty Contest(凸包)

Beauty ContestTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 34900 Accepted: 10800DescriptionBessie, Farmer John's prize cow, has just won first place

2016-08-18 10:16:06 318

原创 UVa 1001 Say Cheese (Floyd)

题目链接:http://acm.hust.edu.cn/vjudge/problem/35891大体题意:给出n个球形洞的坐标和半径,以及小老鼠A和B的坐标,问小老鼠A最快多长时间能到达B的位置。思路:

2016-08-17 19:52:00 877

原创 UVa 658 It's not a Bug, it's a Feature!(最短路问题)

题目链接:http://acm.hust.edu.cn/vjudge/problem/22169大体思路:按照刘汝佳的思路来的,把各个bug的状态(用一个二进制串来表示)当作结点,当前状态到下一状态当作边,然后套用dijkstra算法即可。在寻找边时,直接枚举所有补丁,看看哪个能打上,把打上之后的状态求出来,然后不断更新新状态,当出现0时(即所有bug都消失时),即退出。#include

2016-08-17 09:38:39 349

原创 POJ 3070 Fibonacci(矩阵快速幂)

FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13147 Accepted: 9348DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn

2016-08-16 10:23:56 295

原创 CodeForces 589F Gourmet and Banquet(贪心+二分)

F. Gourmet and Banquettime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA gourmet came into the banquet hall

2016-08-11 19:49:48 496

原创 CodeForces 589B Layer Cake(枚举)

B. Layer Caketime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDasha decided to bake a big and tasty layer c

2016-08-11 19:39:33 435

原创 HDU 4460 Friend Chains(BFS)

Friend ChainsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4943    Accepted Submission(s): 1603Problem DescriptionFor a group of p

2016-08-08 21:05:34 474

原创 UVa 1151 Buy or Build (最小生成树)

题目链接:http://acm.hust.edu.cn/vjudge/problem/36013题目大意:给你n个点,你的任务是让这n个点连通。为此,你有两种方法,1、在某两点之间建边,费用为两点之间欧几里得距离的平方。2、购买一些套餐,当买了某个套餐后,套餐中的这些点将变得相互连通,问完成任务的最小费用是多少。思路:若直接枚举套餐,再求最小生成树,肯定会超时。所以,按刘汝佳说的那样,先求

2016-08-06 09:56:21 509

原创 POJ 3461 Oulipo(KMP)

OulipoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 35475 Accepted: 14348DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La

2016-08-04 20:56:39 255

原创 HDU 4496 D-City(逆向)

D-CityTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 3270    Accepted Submission(s): 1169Problem DescriptionLuxer is a really bad g

2016-08-02 20:15:22 303

原创 UVa 1395 Slim Span (最小生成树)

题意:给出一个n结点的图,求一棵生成树,使其最大边减最小边最小,并求出最小值。思路:将所有边排序,然后暴力求最小生成树即可。#include#include#include#include#includeusing namespace std;const int maxn = 10000;const int INF = 1e9 + 10;int n, m;int pre

2016-08-02 10:46:51 379

原创 HDU 5441 Travel (离线处理+并查集)

TravelTime Limit: 1500/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2914    Accepted Submission(s): 998Problem DescriptionJack likes to travel a

2016-08-02 09:38:50 542

空空如也

空空如也

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

TA关注的人

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