
数据结构
文章平均质量分 85
Megumin
这个作者很懒,什么都没留下…
展开
-
Hdu1166 敌兵布阵 线段树、单点更新
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。原创 2016-07-23 15:29:03 · 324 阅读 · 0 评论 -
HDU1232/NYOJ608 畅通工程 并查集
Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 100原创 2016-08-02 11:54:38 · 827 阅读 · 0 评论 -
Poj1308 Is It A Tree? 并查集
DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following prop原创 2016-07-22 10:32:57 · 575 阅读 · 0 评论 -
Poj1611 The Suspects 并查集基础题
DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best s原创 2016-07-22 00:17:34 · 368 阅读 · 0 评论 -
Poj3468 A Simple Problem with Integers 线段树、区间更新
DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is原创 2016-07-21 23:35:07 · 293 阅读 · 0 评论 -
Poj3264 Balanced Lineup 线段树基础题
DescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows.原创 2016-07-21 21:01:32 · 312 阅读 · 0 评论 -
POJ2492 A Bug's Life 并查集
DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of t原创 2016-07-24 18:37:58 · 275 阅读 · 0 评论 -
POJ1182 食物链 并查集
Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物原创 2016-07-24 16:31:04 · 332 阅读 · 0 评论 -
Hdu1754 I Hate It 线段树、单点更新+区间最值
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0原创 2016-07-24 10:49:54 · 301 阅读 · 0 评论 -
Poj2828 Buy Tickets 线段树、单点更新
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Ca原创 2016-07-23 18:23:49 · 388 阅读 · 0 评论 -
NYOJ116 士兵杀敌(二) 线段数、单点更新
描述南将军手下有N个士兵,分别编号1到N,这些士兵的杀敌数都是已知的。小工是南将军手下的军师,南将军经常想知道第m号到第n号士兵的总杀敌数,请你帮助小工来回答南将军吧。南将军的某次询问之后士兵i可能又杀敌q人,之后南将军再询问的时候,需要考虑到新增的杀敌数。输入只有一组测试数据第一行是两个整数N,M,其中N表示士兵的个数(1随后的一行是N原创 2016-08-02 17:48:37 · 265 阅读 · 0 评论