- 博客(231)
- 资源 (1)
- 收藏
- 关注
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 Atlantis HDU - 1542(扫描线)
There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe diff
2017-10-10 17:34:53
299
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 J - Whistle's New Car Gym - 101147J
StatementsWhistle has bought a new car, which has an infinite fuel tank capacity.He discovered an irregular country since it has n cities and there are exactly n - 1roads between them, of course
2017-10-03 16:07:08
422
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 多校第四场1004 HDU 6070 Dirt Ratio
Problem DescriptionIn ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated in the following way. First let's ignore all the problems the team didn't pass, assume the team passed Xproblems
2017-08-04 10:36:20
321
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 bzoj 4034 [HAOI2015]树上操作
Description有一棵点数为 N 的树,以点 1 为根,且树点有边权。然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加 a 。操作 2 :把某个节点 x 为根的子树中所有点的点权都增加 a 。操作 3 :询问某个节点 x 到根的路径中所有点的点权和。Input第一行包含两个整数 N, M 。表示点数和操作数。接下来一行 N 个整数,表示树中节点...
2017-07-31 12:56:28
274
原创 hdu 4035 概率dp
很好的一个题目具体思路网上说的很多我是参考http://www.cnblogs.com/kuangbin/archive/2012/10/03/2711108.html这个的,感觉写的很浅显易懂存个代码#include using namespace std;typedef long long LL;const int maxn = 10000+10;const d
2017-10-23 20:01:32
263
原创 A - Too Rich HDU - 5527
题目大致意思是你现在有一堆硬币,有10种不同币值的钱a[i]个,先要凑出p元,要使得使用的钱币最多。首先我们可以将问题转化一下,将尽可能多的硬币凑出p转化为尽可能少的硬币凑出sum_val-p。其实我们只要特判下50,500这两种货币的奇偶性就可以大胆的贪心去了哈哈。为什么要特判50,500的奇偶性呢,因为50,不能由20组成,会出问题500同理#include using na
2017-10-22 20:58:19
294
原创 POJ 3162 Walking Race
Walking RaceTime Limit: 10000MS Memory Limit: 131072KTotal Submissions: 4139 Accepted: 1037Case Time Limit: 3000MSDescriptionflymouse’s sister wc is very
2017-10-05 10:46:28
287
原创 HDU 2256 Problem of Precision
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2256这个题目是求
2017-09-03 20:57:33
196
原创 HDU - 4685 Prince and Princess
There are n princes and m princesses. Princess can marry any prince. But prince can only marry the princess they DO love. For all princes,give all the princesses that they love. So, there is a maxim
2017-08-28 17:01:01
376
原创 N - Marriage Match II HDU - 3081
Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy time as so man
2017-08-18 21:18:59
251
原创 HDU 3605 Escape
题意:有n个人要移居m个星球,给出每个合适的星球,每个星球最多能容纳的人数,问是否所有人都可以移居。(1≤N≤105,1≤M≤10) 很明显这里的边有超过1e6条,所以我能直接跑,然后你会发现什么星球竟然只有10个,那么根据鸽巢原理我能不能想到,会有很多很多的人的选择是重复的,不重复的选择最多有2^10种,所以我们选择用二进制判重加缩点的方式来减少边的数量,然后就是跑最大流就可以了。#
2017-08-18 11:29:56
239
原创 POJ2112 Optimal Milking(最大流+二分答案)
题意: 有K个挤奶器,和C头牛,让你求所有牛到挤奶器的最近距离的最远是多大。题解: 由于挤奶器的不唯一,所以我们不能直接的求,然后对于多源点的求解问题,我们应该很直观的会有一个想法,那就是最大流能不能搞?事实证明这个方法是可行的,我们用folyd预处理求出两点间的最短距离,然后二分距离,如果当前距离是我们构成的流的最大值等于牛的个数那么证明当前距离是可行的方案,然后
2017-08-16 11:07:18
243
原创 POJ3281Dining(最大流入门题)
AC代码,题解后期补#include #include #include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int max_m = 1e6+1000;const int max_n = 400
2017-08-15 11:05:49
275
原创 B - Flowery Trails UVALive - 6885 spfa
题意:求最短路上的边权之和并*2题解:枚举边天哪,赛时我怎么没想出来,气死了#include #include #include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int max_m
2017-08-11 20:09:05
231
原创 编辑距离问题+滚动数组优化
输入第1行:字符串a(a的长度 <= 1000)。第2行:字符串b(b的长度 输出输出a和b的编辑距离输入示例kittensitting输出示例3#include #include #include #include #include #include using n
2017-08-08 00:11:50
523
原创 FZU - 2082 过路费
树剖的裸题,中文题面所以就不多解释了,当然操作二,就是简单的求过路费之和,因为路径唯一,他的那个最少过路费我也是醉了。#include #include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const in
2017-08-03 19:11:28
220
原创 SDOI2014旅行
题意:有一棵树,每个节点有两个值(一个是种类,一个是价值)有四个操作1、修改某点的种类。2、修改某点的价值。3、给出两个点(种类相同),求这两点之间路径上和他们种类相同的点的最大价值4、给出两个点(种类相同),求这两点之间路径上和他们种类这个题敲了整整一天啊,一开始不太明白动态开点什么意思,最后终于明白了,然后无情的被T了一片一片的,终于A了,好开心!!!
2017-08-02 21:03:43
225
原创 POJ2763
/*题意:有一颗树,每条边有边权 有两个操作:1、给出一个点x,求当前点s和点x所在的路径上的边的边权之和(然后s=x)。2、给出一个边i和一个值val,把第i条边的边权修改为val。节点数 1e5 操作数1e5 边权1e4 val ≤ 1e4*/#include #include #include #include #include #in
2017-08-02 12:37:36
664
7
原创 HYSBZ 1036 树的统计Count
题意:有一棵树,每个节点有权值。我们现在有三个操作:1、改变某点的权值。2、给出两个点,求这两个点之间的路径上所有点的权值之和。3、给出两个点,求这两个点之间的路径上所有点的最大权值。一个裸的树剖,刷了两三天树剖的题了,感觉现在已经把树剖理解的差不多了,具体操作现在已经可以很快在脑海中模拟出来了。#include #include #include #include
2017-08-02 09:20:15
194
原创 bzoj2243染色
2243: [SDOI2011]染色Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 8002 Solved: 3005[Submit][Status][Discuss]Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点
2017-08-01 10:33:11
238
原创 HDU - 3966 - Aragorn's Story
题意:给你一颗树,每个节点都有点权,有两个操作1、求某个点的点权。2、给出两个点u,v和一个值value,将由点u到点v路径上的点的权值+value(包括u,v)。节点数 操作数 初始边权 |value| 树链剖分的入门题,今天刚学了树链剖分。感觉树剖还是很有用的,毕竟把一棵树上的操作转化成对于一个区间的操作,会简单方便很多。今天看了不少的博客,感觉比之前收获了
2017-07-31 00:10:35
212
原创 Problem J. Journey to the “The World’s Start”
存个代码#include #include #include #include #define lson root*2,l,Mid#define rson root*2+1,Mid+1,rusing namespace std;typedef long long LL;#define INF 0x3f3f3f3f3f3f3f3fll#define maxn 50010int
2017-07-30 13:05:35
341
原创 HDU - 4283 You Are the One(区间dp)
The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in the Small hall, so it attract a lot o
2017-07-27 08:56:07
237
原创 HDU - 4284 Travel(状压dp)
PP loves travel. Her dream is to travel around country A which consists of N cities and M roads connecting them. PP has measured the money each road costs. But she still has one more problem: she does
2017-07-26 22:07:24
224
原创 POJ 3186 Treats for the Cows(区间dp)
Treats for the CowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6180 Accepted: 3223DescriptionFJ has purchased N (1 The treats are interesting fo
2017-07-26 10:37:47
202
原创 HDU 6034 Balala Power!
Balala Power!Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2145 Accepted Submission(s): 398Problem DescriptionTalente
2017-07-26 08:58:26
204
原创 D - Doing Homework(状压dp)
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after th
2017-07-25 21:16:22
1227
1
原创 CF 255 C Almost Arithmetical Progression
Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elemen
2017-07-19 18:21:37
265
原创 CF 214 B Hometask.cpp
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved
2017-07-19 18:15:59
256
原创 CF 214 A System of Equations
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved
2017-07-19 18:10:17
220
原创 UVA 706 LC-Display
WA了好几发才发现9下面少了一横,OMG!!!一个简单的模拟,细心就能过#include #include #include #include #include #include #include using namespace std;int N,M;int a[200],cnt;char str[100];void heng_1(){ for(int i = c
2017-07-19 18:06:07
342
原创 G - 免费馅饼
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝
2017-07-18 16:17:06
274
原创 HDU 3078 Network tarjan算法
/*NetworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1304 Accepted Submission(s): 581Problem DescriptionThe ALPC company is now w
2017-07-11 14:34:55
201
原创 zoj 3195 Design the city
/*Design the cityTime Limit: 1 Second Memory Limit: 32768 KBCerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams e
2017-07-11 10:17:10
269
原创 HDU 2874 Connections between cities
第一、注意 head_tree[],head_query[]只需要开到节点的个数那么多就可以了,MLE了好几发才意识到的,尴尬第二这个题目需要特判下这两个节点是不是在一棵树上剩下的就是求LCA了#include #include #include #include #include #include using namespace std;const int Tmaxn
2017-07-06 15:41:47
160
原创 POJ 1986 Distance Queries
Distance QueriesTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 13849 Accepted: 4880Case Time Limit: 1000MSDescriptionFarmer John's cows refused t
2017-07-06 13:27:06
170
原创 POJ 1470 Closest Common Ancestors
一个裸的LCA,唯一的坑点就在于输入(╯‵□′)╯︵┻━┻,不得不GG#include #include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int maxn = 1000;struct tr
2017-07-05 22:12:19
146
原创 HDU 2586 How far away ?
题意 在一棵树上问你两点之间的距离裸的LCA这里我用了离线算法的Tarjan做的(今天刚学的GG,在线的算法暂时还没看)#include #include #include #include #include #include using namespace std;typedef long long LL;const int Tmaxn = 40000+10;con
2017-07-05 21:11:41
148
原创 Spoj 1716 Can you answer these queries III
和Spoj 1716 Can you answer these queries I一个题意#include #include #include #include #include #include using namespace std;typedef long long LL;const LL INF = 0x3f3f3f3f3f3f3f3fll;const int max
2017-07-05 20:18:49
240
原创 SPOJ 1043 Can you answer these queries I
需要维护的是最大和只能是 max(max(Nodes[now所以我们要维护的是lmax,rmax,max,sum四个信息#include #include #include #include #include using namespace std;#define LL long long#define Now int now,int l,int r#define Mid
2017-07-05 20:16:57
204
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人