自定义博客皮肤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

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

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

原创 UVA 11733 Airports

最小生成森林,其实就是最小生成树的做法,稍加修改即可。 #include #include #include #include using 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 442

原创 CodeForces 735E Ostap and Tree

Description Ostap 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 1085

原创 POJ 2728 Desert King

Description David 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

Description Bogdan 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 405

原创 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

Description Mad 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

Description After 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

Description Our 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 226

原创 Codeforces Gym 101142G

#include #include #include #include using 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

Description For 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

Description In 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的路径上的节点的最大权值 I II. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身

2016-11-06 21:10:50 221

原创 HDU 5072 Coprime

Description There 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

Description You 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

空空如也

空空如也

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

TA关注的人

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