
ACM__数据结构
文章平均质量分 78
Element-YoNg
每天晚上疲劳的睡在床上时,才感觉真真切切地过了一天。压力不是有人比你努力,而是比你牛逼几倍的人依然比你努力。即使看不到未来,也依然相信,自己选的人生错不了。第二天叫醒我的不是闹钟,其实,还是梦想。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
CSU 1082: 憧憬一下集训 (线段树 扫描线)
连接 :http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1082题目可以将每个人的两种适应度转化为一个在坐标系里的矩形。假设音量为x轴,空调为y轴。那么题目要求的可以转化为 在所有的矩形里选择一个点 这个点可以覆盖最多的矩形。题目可以进一步转化 需要用到扫描线,只考虑每个矩形的上边和下边,每个边都构成一个扫描线(沿着y轴方向原创 2015-05-15 16:21:58 · 718 阅读 · 0 评论 -
CF #261 Div2 D. Pashmak and Parmida's problem (离散化+逆序对+线段树)
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for原创 2014-08-16 21:04:00 · 680 阅读 · 0 评论 -
POJ 2528 Mayor's posters (离散化+线段树区间更新)
DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city counci原创 2014-08-16 12:40:21 · 803 阅读 · 0 评论 -
非结构体线段树版 ZJU 1610 Count the Colors (线段树区间更新)
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.原创 2014-08-14 10:29:42 · 819 阅读 · 0 评论 -
CF#52 C Circular RMQ (线段树区间更新)
DescriptionYou are given circular array a0, a1, ..., an - 1. There are two types of operations with it: inc(lf, rg, v) — this operation increases each element on the segment[lf, rg] (inclu原创 2014-08-14 22:08:08 · 1023 阅读 · 0 评论 -
Light OJ 1080 - Binary Simulation - (线段树区间更新 单点查询)
DescriptionGiven a binary number, we are about to do some operations on the number. Two types of operations can be here.'I i j' which means invert the bit fromi to j (inclusive)'Q i' a原创 2014-08-14 11:58:02 · 1049 阅读 · 0 评论 -
HDU 1698 Just a Hook (线段树区间更新)
Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same原创 2014-08-13 16:16:54 · 578 阅读 · 0 评论 -
POJ 2777 Count Color (线段树区间更新加查询)
DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L原创 2014-08-13 21:21:31 · 500 阅读 · 0 评论 -
POJ 3067 Japan (树状数组)
DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <=原创 2014-08-24 23:25:15 · 562 阅读 · 0 评论 -
求逆序对(线段树版)
一个序列a1,a2,a3...aN,求出满足:ai > aj 且 i 一个最容易想到的方法就是枚举所有的i,j看看是否满足,显然是O(n^2)的复杂度。不够好。可以这样考虑,开一个数组保存这n个数出现的位置和对应的次数,这个数组要开到a数组里最大的那个数MAX,也就是hash,初始状态数组里没有元素,每个数对应的个数都是0.如果考虑第i个数,找到比它大的所有的数 的个数,查找的范围即原创 2014-08-16 22:46:23 · 6020 阅读 · 0 评论 -
HDU 1754 I Hate It (线段树版 + 树状数组版)
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N原创 2014-05-15 13:39:56 · 915 阅读 · 0 评论 -
2014湘潭邀请赛 C题 湘大OJ 1205 Range (单调栈)
Problem DescriptionFor an array, the range function is defined below: Range(A)=Max(A)-Min(A)+1; For example, suppose A={1,2,3,4,5}, then Range(A)=5-1+1=5. Now, given an array A(length≤100000), you a原创 2014-09-03 22:36:24 · 2070 阅读 · 1 评论 -
Flipping Parentheses (线段树 单点更新 区间查询)
题目链接 : 点击打开链接题目大意 : 给一个括号已经匹配好的序列,每次反转一个括号, 然后让你再次反转一个括号再次使得括号匹配,并且你反转的位置尽可能的靠近左端。可以对于每个位置,记录它之前的左括号的数量减去右括号的数量,这个序列合法的条件就是每个位置不会出现值小于0的情况。最后一位一定是0.如果他反转的是右括号,这个位置变成左括号之后 你需要找到一个左括号把它反成右括号原创 2015-03-26 17:14:11 · 770 阅读 · 0 评论 -
HDU 1832 Luck and Love (二维线段树)
Problem Description世界上上最远的距离不是相隔天涯海角而是我在你面前可你却不知道我爱你 ―― 张小娴前段日子,枫冰叶子给Wiskey做了个征婚启事,聘礼达到500万哦,天哪,可是天文数字了啊,不知多少MM蜂拥而至,顿时万人空巷,连扫地的大妈都来凑热闹来了。―_―|||由于人数太多,Wiskey实在忙不过来,就把统计的事情全原创 2014-11-07 17:42:44 · 1034 阅读 · 0 评论 -
HDU 4819 Mosaic (二维线段树)
Problem DescriptionThe God of sheep decides to pixelate some pictures (i.e., change them into pictures with mosaic). Here's how he is gonna make it: for each picture, he divides the picture into n x原创 2014-11-07 18:15:55 · 718 阅读 · 0 评论 -
BZOJ 1798: [Ahoi2009]Seq 维护序列seq (线段树乘法加法的混合操作)
题目:点击打开链接大意:一个数组,三个操作,第一种是区间[a,b]每个数乘乘,第二种是区间[a,b]每个数加c,第三种是查询[a,b]区间的和并对p取摸。两种操作就不能简单的只往下传标记。每次传乘法标记时,要把加法标记同时乘上乘法标记,例如某个区间先进来一个加法标记add,之后又进来一个乘法标记mul。那么结果为(x + add) * mul = x * mul + add原创 2014-10-15 16:53:37 · 1879 阅读 · 0 评论 -
Vijos P1881 闪烁的繁星 (自己加强了一下。。)
如果每一次查询的不是整个长度,而是[x, y]这个区间。。闲来无事自己写了一下,感觉是对的,这样就变成了合并区间。#include #include #include #include #include #include #define mem(f) memset(f,0,sizeof(f))#define M 100005#define mod 1000000007原创 2014-10-10 01:36:57 · 987 阅读 · 0 评论 -
HDU 1710 Binary Tree Traversals
Problem DescriptionA binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most impor原创 2014-10-09 12:24:26 · 847 阅读 · 0 评论 -
Vijos P1881 闪烁的繁星
背景繁星闪烁着--深蓝的太空何曾听得见他们对语沉默中微光里他们深深的互相颂赞了描述繁星, 漫天的繁星.繁星排成一列, 我数一数呀, 一共有N只小星星呢.星星们是听话的好孩子, 小岛在指挥它们跳舞呢.舞蹈开始前, 它们都亮了起来!小岛指一指第i只小星星, 只见第i只小星星立刻改变了自己的状态.如果它之前是亮着的, 那么立刻就灭掉了.原创 2014-10-09 16:12:09 · 832 阅读 · 0 评论 -
POJ 1838 Banana (并查集)
DescriptionConsider a tropical forrest, represented as a matrix. The cell from the right top corner of the matrix has the coordinates (1,1), and the coordinates of the other cells are determinated原创 2014-09-05 00:10:13 · 1162 阅读 · 0 评论 -
HDU 3874 Necklace (线段树单点更新+区间查询+离线操作)
Problem DescriptionMery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more原创 2014-08-12 13:54:15 · 842 阅读 · 0 评论 -
POJ 1195 Mobile phones (二维树状数组)
DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows原创 2014-08-22 11:58:11 · 763 阅读 · 0 评论 -
BZOJ 1452: [JSOI2009]Count (二维树状数组)
DescriptionInputOutputSample InputSample Output12HINT二维树状数组的简单应用,c数组的第一维坐标相当于哈希。如果是修改操作,修改前 将当前的值的个数以及祖先都减1, 修改后将个数加1.#include #include #include #i原创 2014-08-21 23:49:07 · 780 阅读 · 0 评论 -
POJ 2828 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原创 2014-08-03 21:06:04 · 568 阅读 · 0 评论 -
HDU 2795 Billboard
Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcement原创 2014-05-15 13:33:52 · 628 阅读 · 0 评论 -
Uva 514 Rails
There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to e原创 2014-06-11 21:56:51 · 1048 阅读 · 0 评论 -
HDU 2072 单词数(Tire 和 set 两解)
Problem Descriptionlily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。 Input有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。 Output原创 2014-06-07 15:14:10 · 940 阅读 · 0 评论 -
HDU 1247 Hat’s Words
Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the hat’s words in a dictionary. In原创 2014-06-07 19:09:25 · 710 阅读 · 0 评论 -
HDU 1075 What Are You Talking About
Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leave原创 2014-06-07 16:37:00 · 710 阅读 · 0 评论 -
HDU 1305 Immediate Decodability
Problem DescriptionAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all原创 2014-06-06 22:00:19 · 805 阅读 · 0 评论 -
HDU 1251 统计难题
Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是原创 2014-06-06 21:23:02 · 693 阅读 · 0 评论 -
POJ 2886 Who Gets the Most Candies? (线段树)
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The原创 2014-08-04 15:31:34 · 703 阅读 · 0 评论 -
POJ 3468 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原创 2014-08-05 10:28:05 · 742 阅读 · 0 评论 -
HDU 1022 Train Problem I (数据结构 —— 栈)
Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is t原创 2014-08-01 12:05:19 · 718 阅读 · 0 评论 -
HDU 3584 Cube (三维树状数组)
Problem DescriptionGiven an N*N*N cube A, whose elements are either 0 or 1. A[i, j, k] means the number in the i-th row , j-th column and k-th layer. Initially we have A[i, j, k] = 0 (1 <= i, j, k <原创 2014-08-23 00:16:20 · 972 阅读 · 0 评论 -
CodeForces 91B Queue (线段树单点操作)
DescriptionThere are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the1-st walrus stands at the end of the queue and the n-th walrus stands at原创 2014-09-05 19:29:22 · 1442 阅读 · 0 评论 -
NOIP 提高组2013 火柴排队 (Vijos P1842)
描述涵涵有两盒火柴,每盒装有 n 根火柴,每根火柴都有一个高度。现在将每盒中的火柴各自排成一列,同一列火柴的高度互不相同,两列火柴之间的距离定义为:∑ i=1 n (a i −b i ) 2 ,其中a i 表示第一列火柴中第 i 个火柴的高度,b i 表示第二列火柴中第 i 个火柴的高度。 每列火柴中相邻两根火柴的位置都可以交换,请你通过交换使得两列火柴之间的距离原创 2014-08-17 11:58:15 · 1158 阅读 · 0 评论 -
HDU 3333 Turing Tree (离散化+离线处理+树状数组)
Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solution. As well, wily 3xian made lots of n原创 2014-08-20 10:51:56 · 806 阅读 · 0 评论 -
CF #261 div2 D. Pashmak and Parmida's problem (树状数组版)
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for原创 2014-08-19 00:32:26 · 1096 阅读 · 0 评论 -
HDU 1541 Stars (树状数组)
Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars tha原创 2014-08-18 22:59:32 · 765 阅读 · 0 评论