自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Occult

新的一年,新的期待,新的希望,新的我,也期望新的故事。

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

原创 UVA 1395 Slim Span

DescriptionGiven an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, …, vn} an

2016-12-06 13:27:09 287

原创 HDU 5669 Road

Road  Accepts: 4  Submissions: 61 Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072/131072 K (Java/Others)问题描述\ \ \ \    TA想要让别人把他叫做Taishenle [Au]gust.\ \ \ \

2016-12-05 19:35:37 454

原创 HYSBZ 2763 飞行路线

DescriptionAlice和Bob现在要乘飞机旅行,他们选择了一家相对便宜的航空公司。该航空公司一共在n个城市设有业务,设这些城市分别标记为0到n-1,一共有m种航线,每种航线连接两个城市,并且航线有一定的价格。Alice和Bob现在要从一个城市沿着航线到达另一个城市,途中可以进行转机。航空公司对他们这次旅行也推出优惠,他们可以免费在最多k种航线上搭乘飞机。那么Alice和Bob这次

2016-12-04 14:12:40 415

原创 HDU 2121 Ice_cream’s world II

DescriptionAfter awarded lands to ACMers, the queen want to choose a city be her capital. This is an important event in ice_cream world, and it also a very difficult problem, because the world hav

2016-12-03 20:19:42 258

原创 PAT (Top Level) Practise 1013 Image Segmentation (35)

Image segmentation is usually formulated as a graph partition problem, where each segment corresponds to a connected component. Moreover, each pixel is the vertex of the graph. Each edge has a weight,

2016-12-02 15:44:49 3681 2

原创 至逝去的11月

不知不觉一个月又过去了呢。这个月去了一次青岛,玩的还是挺开心的。唯一无奈的是这个出题人实在是zz到不行,我怀疑他不会出题,这个人出的题,从来就没有区分度,简单的题就是像a+b这样的弱智,难的题就是一坨屎谁都不会想起吃。这就算了,出的稍微中等的题几乎都是一个类型,就是算概率算概率,md这个人大概是概率论挂科留下来的怨念吧。而且数据出的也是十分zz,自己定位的高难度的题被一群用暴力的水

2016-12-01 17:24:02 418

原创 树链剖分小结

点击打开链接之前搞定的树链剖分专题,之前的状态持续萎靡,虽然现在仍旧是。不过总结什么的总得写一点的。之前还有挺多东西,都想补补,不过现在实在是懒癌晚期,完全不想干,等寒假的时候再看看吧。树链剖分,简单的说,其实就是把一棵树拆成很多条链,然后铺到一个区间里,这样就可以把树上的问题转换成简单的区间问题,而区间问题我们可以用线段树和树状数组等等数据结构来维护。其实,dfs序列

2016-12-01 17:13:22 292

原创 POJ 3164 Command Network

DescriptionAfter a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by KnuthOcean’s force has rendered a to

2016-12-01 16:57:00 285

原创 UVA 11733 Airports

最小生成森林,其实就是最小生成树的做法,稍加修改即可。#include#include#include#includeusing namespace std;#define rep(i,j,k) for(int i=j;i<=k;i++)#define loop(i,j,k) for (int i=j;i!=-1;i=k[i])#define inone(x) scanf("%d

2016-11-30 10:13:06 443

原创 CodeForces 735E Ostap and Tree

DescriptionOstap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph.Ostap's tree now has n vertice

2016-11-29 13:49:05 1086

原创 POJ 2728 Desert King

DescriptionDavid the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every village. Villag

2016-11-27 16:43:24 238

原创 CodeForces 593D Happy Tree Party

DescriptionBogdan has a birthday today and mom gave him a tree consisting of n vertecies. For every edge of the tree i, some number xi was written on it. In case you forget, a tree is a connecte

2016-11-24 23:14:59 406

原创 HYSBZ 4196 软件包管理器

Description Linux用户和OSX用户一定对软件包管理器不会陌生。通过软件包管理器,你可以通过一行命令安装某一个软件包,然后软件包管理器会帮助你从软件源下载软件包,同时自动解决所有的依赖(即下载安装这个软件包的安装所依赖的其它软件包),完成所有的配置。Debian/Ubuntu使用的apt-get,Fedora/CentOS使用的yum,以及OSX下可用的homebrew都是优

2016-11-23 20:55:08 292

原创 CodeForces 343D Water Tree

DescriptionMad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with water.The vertices of the tree are

2016-11-23 20:27:39 327

原创 HYSBZ 2588 Spoj 10628. Count on a tree

Description给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权。其中lastans是上一个询问的答案,初始为0,即第一个询问的u是明文。Input第一行两个整数N,M。第二行有N个整数,其中第i个整数表示点i的权值。后面N-1行每行两个整数(x,y),

2016-11-22 19:49:27 324

原创 HYSBZ 3531 旅行

Description S国有N个城市,编号从1到N。城市间用N-1条双向道路连接,满足从一个城市出发可以到达其它所有城市。每个城市信仰不同的宗教,如飞天面条神教、隐形独角兽教、绝地教都是常见的信仰。为了方便,我们用不同的正整数代表各种宗教,  S国的居民常常旅行。旅行时他们总会走最短路,并且为了避免麻烦,只在信仰和他们相同的城市留宿。当然旅程的终点也是信仰与他相同的城市。S国政府为每

2016-11-22 16:34:08 509

原创 HYSBZ 4034 T2

Description 有一棵点数为 N 的树,以点 1 为根,且树点有边权。然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加 a 。操作 2 :把某个节点 x 为根的子树中所有点的点权都增加 a 。操作 3 :询问某个节点 x 到根的路径中所有点的点权和。Input 第一行包含两个整数 N, M 。表示点数和操作数。

2016-11-21 19:14:39 349

原创 FZU 2082 过路费

Description有n座城市,由n-1条路相连通,使得任意两座城市之间可达。每条路有过路费,要交过路费才能通过。每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费。Input有多组样例,每组样例第一行输入两个正整数n,m(2 Output对于每个询问,输出一行,表示最少要花的过路费。

2016-11-21 16:59:50 338

原创 POJ 2763 Housewife Wind

DescriptionAfter their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts connect

2016-11-21 16:40:39 223

原创 HDU 3966 Aragorn's Story

DescriptionOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn knows, the enemy

2016-11-20 14:44:39 227

原创 Codeforces Gym 101142G

#include#include#include#includeusing namespace std;const int N=1e6+10;int n,q;int to[N],nx[N],h[N],sz;int dep[N][25];int L[N],R[N],b[N],c[N];int g[N],f[N],t[N];set s[N];set::iterator it;

2016-11-19 22:20:13 560

原创 HDU 4194 Peer Review

DescriptionFor scienti c conferences, scientists submit papers presenting their ideas, and then review each other's papers to make sure only good papers are presented at the conference. Each paper

2016-11-09 11:04:05 437

原创 HDU 4196 Remoteland

DescriptionIn the Republic of Remoteland, the people celebrate their independence day every year. However, as it was a long long time ago, nobody can remember when it was exactly. The only thing p

2016-11-09 11:01:27 302

原创 HYSBZ 2243 染色

Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“ 112221 ” 由3段组成:“ 11 ” 、“ 222 ” 和“ 1 ” 。请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,

2016-11-07 18:01:21 242

原创 HYSBZ 1036 树的统计Count

Description  一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身

2016-11-06 21:10:50 221

原创 HDU 5072 Coprime

DescriptionThere are n people standing in a line. Each of them has a unique id number. Now the Ragnarok is coming. We should choose 3 people to defend the evil. As a group, the 3 people should

2016-11-04 18:41:53 307

原创 SPOJ QTREE Query on a tree

DescriptionYou are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions of the following form:CH

2016-11-04 18:36:06 273

原创 10月小结

10月征战了 ccpc合肥,打铜。去了icpc 沈阳,拿银。总的来说,这两场都打崩了,我们没能脱离自己的怪圈,每次比赛开场总能在金牌区待着,但是中期开始就持续下滑,而且很难再回来了。每场比赛,总会有一两道大家都会而我们却卡住甚至到最后都过不了的题。照理说,这种题放在平时的训练赛里,绝对不可能卡那么久,但是真的到了赛场上,又有很大不同。值得庆幸的是,我们拿到了我校历史以来第一个区域赛

2016-11-01 23:03:25 419

原创 HDU 4777 Rabbit Kingdom

Description  Long long ago, there was an ancient rabbit kingdom in the forest. Every rabbit in this kingdom was not cute but totally pugnacious, so the kingdom was in chaos in season and out of se

2016-10-30 00:11:14 373

原创 UVALive 7141 BombX

2014上海区域赛的D题,十分复杂的感觉。按照x坐标排序,对于炸弹来说,不考虑y坐标的情况,可以看成数轴上的一个线段,当线段向右移动的时候,可以知道每一个时刻,线段上有多少的点,这一点显然可以用twopoint搞定O(n)得到。然后对于每一个时刻,炸弹能炸的最多的数量,显然是当前在线段上的点,以及不在线段上的点里,用H能覆盖的最多的情况,当然,要去掉不能覆盖的那些位置。这一点,

2016-10-27 20:46:42 444

原创 UVALive 7148 LRIP

2014年上海区域赛的K题,树上点分治,查找差值小于等于D的非严格单调序列的最长长度。对于每个点,维护从该点出发的上升序列同长度的最小值和下降序列的同长度最大值,二分之前的得到答案。#include#include#include#include#include#include#include#include#include#include#include#inclu

2016-10-26 20:02:32 305

原创 已经结束的9月

这个月尝试的研究了数论的内容,感觉脑子被掏空?!接下来就要开始出征了,希望今年能有个好运气,万事顺利吧。

2016-10-02 21:20:07 396 2

原创 HDU 5868 Different Circle Permutation

DescriptionYou may not know this but it's a fact that Xinghai Square is Asia's largest city square. It is located in Dalian and, of course, a landmark of the city. It's an ideal place for outing a

2016-09-29 17:46:47 631

原创 HDU 2588 GCD

DescriptionThe greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6. (a,b) can be easi

2016-09-29 17:41:21 268

原创 HDU 1787 GCD Again

DescriptionDo you have spent some time to think and try to solve those unsolved problem after one ACM contest? No? Oh, you must do this when you want to become a "Big Cattle". Now you will fin

2016-09-29 17:40:12 238

原创 HDU 1286 找新朋友

Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1Output

2016-09-29 17:39:25 300

原创 HDU 1695 GCD

DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be ver

2016-09-29 17:36:58 277

原创 HDU 2824 The Euler function

DescriptionThe Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot

2016-09-29 17:34:25 366

原创 HDU 4335 What is N?

Description  (This problem is really old&easy and any acmer who is good at math may solve it in second)   As we know, math is both intangible and specific. Today you are going to solve the follo

2016-09-29 17:33:14 330

原创 HDU 2837 Calculation

DescriptionAssume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).InputThe first

2016-09-29 17:30:49 411

空空如也

空空如也

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

TA关注的人

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